mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
* boot-9.scm (struct-printer): Bugfix: Check the layout of the
vtable and not the one of the struct.
This commit is contained in:
parent
5dade85779
commit
755da2fc99
1 changed files with 6 additions and 5 deletions
|
@ -332,11 +332,12 @@
|
|||
(define %struct-printer-tag (cons '%struct-printer-tag #f))
|
||||
|
||||
(define (struct-printer s)
|
||||
(and (>= (string-length (struct-layout s))
|
||||
(* 2 struct-vtable-offset))
|
||||
(let ((p (struct-ref (struct-vtable s) struct-vtable-offset)))
|
||||
(and (eq? (car p) %struct-printer-tag)
|
||||
(cdr p)))))
|
||||
(let ((vtable (struct-vtable s)))
|
||||
(and (>= (string-length (struct-layout vtable))
|
||||
(* 2 struct-vtable-offset))
|
||||
(let ((p (struct-ref vtable struct-vtable-offset)))
|
||||
(and (eq? (car p) %struct-printer-tag)
|
||||
(cdr p))))))
|
||||
|
||||
(define (make-struct-printer printer)
|
||||
(cons %struct-printer-tag printer))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue