declare a record's typedef ahead of its struct
It came after, so a record pointing at itself, (next (* node)), named a type C had not been told of yet.
This commit is contained in:
20
semen.scm
20
semen.scm
@@ -1903,13 +1903,19 @@
|
||||
(unless (symbol? name)
|
||||
(sex-error form "record needs a name" form))
|
||||
(add-typedef name `(typedef ,name (struct ,name)))
|
||||
(cons (copy-form-source! form `(typedef (struct ,name) ,name))
|
||||
(process-struct
|
||||
(copy-form-source! form
|
||||
(if (eq? (car form) 'pub)
|
||||
`(pub struct ,@(cdr core))
|
||||
`(struct ,@(cdr core))))
|
||||
acc))))
|
||||
;; the typedef first, so a field may point back at the record, and
|
||||
;; the docstring ahead of both
|
||||
(let-values (((doc struct)
|
||||
(extract-aggregate-docstring
|
||||
(copy-form-source! form
|
||||
(if (eq? (car form) 'pub)
|
||||
`(pub struct ,@(cdr core))
|
||||
`(struct ,@(cdr core)))))))
|
||||
(process-struct
|
||||
struct
|
||||
(with-docstring doc
|
||||
(copy-form-source! form `(typedef (struct ,name) ,name))
|
||||
acc)))))
|
||||
|
||||
(define (register-aggregate! form)
|
||||
(let* ((f (if (eq? (car form) 'pub) (cdr form) form))
|
||||
|
||||
Reference in New Issue
Block a user