mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Add a global's initialization to the top-level if
it is assigned to another global. EG: (define a b). If b is not initialized until the top-level, then a must be initialized there as well, otherwise it will pick up the old value of b.
This commit is contained in:
parent
4e953b64c3
commit
8c0ce30c2e
1 changed files with 7 additions and 2 deletions
|
@ -926,8 +926,13 @@
|
|||
;; into two parts - use the define to initialize it to false (CPS is fine),
|
||||
;; and place the expression into a top-level (set!), which can be
|
||||
;; handled by the existing CPS conversion.
|
||||
((and (list? (car (define->exp (car top-lvl))))
|
||||
(not (lambda? (car (define->exp (car top-lvl))))))
|
||||
((or
|
||||
;; TODO: the following line may not be good enough, a global assigned to another
|
||||
;; global may still be init'd to nil if the order is incorrect in the "top level"
|
||||
;; initialization code.
|
||||
(symbol? (car (define->exp (car top-lvl)))) ;; TODO: put these at the end of top-lvl???
|
||||
(and (list? (car (define->exp (car top-lvl))))
|
||||
(not (lambda? (car (define->exp (car top-lvl)))))))
|
||||
(loop (cdr top-lvl)
|
||||
(cons
|
||||
`(define ,(define->var (car top-lvl)) #f)
|
||||
|
|
Loading…
Add table
Reference in a new issue