mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 03:36:34 +02:00
WIP
This commit is contained in:
parent
b37cbc3106
commit
23aaae8f05
1 changed files with 12 additions and 7 deletions
|
@ -839,7 +839,7 @@
|
||||||
"\n"
|
"\n"
|
||||||
cgen-body ;; TODO: (c:body cgen) ;; TODO: re-assign function args, longer-term using temp variables
|
cgen-body ;; TODO: (c:body cgen) ;; TODO: re-assign function args, longer-term using temp variables
|
||||||
"\n"
|
"\n"
|
||||||
"goto loop;")))
|
"continue;")))
|
||||||
)
|
)
|
||||||
|
|
||||||
((prim? fun)
|
((prim? fun)
|
||||||
|
@ -1484,10 +1484,15 @@
|
||||||
(> (string-length tmp-ident) 3)
|
(> (string-length tmp-ident) 3)
|
||||||
(equal? "self" (substring tmp-ident 0 4))))
|
(equal? "self" (substring tmp-ident 0 4))))
|
||||||
(has-loop?
|
(has-loop?
|
||||||
(and (not has-closure?) ;; Only top-level functions for now
|
(or
|
||||||
(pair? trace)
|
(adbf:calls-self? (adb:get/default (ast:lambda-id exp) (adb:make-fnc)))
|
||||||
(not (null? (cdr trace)))
|
;; Older direct recursive logic
|
||||||
(adbv:direct-rec-call? (adb:get (cdr trace)))))
|
(and (not has-closure?) ;; Only top-level functions for now
|
||||||
|
(pair? trace)
|
||||||
|
(not (null? (cdr trace)))
|
||||||
|
(adbv:direct-rec-call? (adb:get (cdr trace))))
|
||||||
|
)
|
||||||
|
)
|
||||||
(formals*
|
(formals*
|
||||||
(string-append
|
(string-append
|
||||||
(if has-closure?
|
(if has-closure?
|
||||||
|
@ -1536,8 +1541,8 @@
|
||||||
(else
|
(else
|
||||||
(string-append
|
(string-append
|
||||||
(st:->code trace)
|
(st:->code trace)
|
||||||
;; TODO: probably needs brackets afterwards...
|
TODO: does not work for calls-self, need to invoke that elsewhere...
|
||||||
(if has-loop? "\nloop: {\n" "")
|
(if has-loop? "\n while(1) {\n" "")
|
||||||
))))
|
))))
|
||||||
body)
|
body)
|
||||||
" ")
|
" ")
|
||||||
|
|
Loading…
Add table
Reference in a new issue