forked from alex-eg/sex
keep a module's public forms in declaration order
read-public-interface folded with cons and never reversed, so an imported pub fn whose prototype named a type declared above it in the same module was pasted before that type, and the unit did not compile.
This commit is contained in:
@@ -65,12 +65,16 @@
|
|||||||
module-path))))
|
module-path))))
|
||||||
|
|
||||||
(define (read-public-interface module-path)
|
(define (read-public-interface module-path)
|
||||||
;; pub fns are reduced to prototypes, other pub forms are just pasted
|
;; pub fns are reduced to prototypes, other pub forms are just pasted.
|
||||||
|
;; Declaration order is kept: a module that declares a type and then a
|
||||||
|
;; pub fn taking it has to paste them that way round, or the prototype
|
||||||
|
;; names a type C has not seen.
|
||||||
(let ((raw-forms (read-from-file module-path)))
|
(let ((raw-forms (read-from-file module-path)))
|
||||||
(fold
|
(reverse
|
||||||
process-public-interface-form
|
(fold
|
||||||
(list)
|
process-public-interface-form
|
||||||
raw-forms)))
|
(list)
|
||||||
|
raw-forms))))
|
||||||
|
|
||||||
(define (public-fn-interface raw-form)
|
(define (public-fn-interface raw-form)
|
||||||
;; (pub fn name args ret . body) -> prototype, keeping a docstring so
|
;; (pub fn name args ret . body) -> prototype, keeping a docstring so
|
||||||
|
|||||||
Reference in New Issue
Block a user