1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-31 09:20:23 +02:00
guile/module/language/js-il/direct.scm
2015-06-18 04:14:42 +01:00

36 lines
1 KiB
Scheme

(define-module (language js-il direct)
#:use-module (ice-9 match)
#:use-module (language js-il)
#:export (remove-immediate-calls))
(define (remove-immediate-calls exp)
(match exp
(($ program entry body)
(make-program (remove-immediate-calls entry)
(map remove-immediate-calls body)))
(($ continuation params body)
(make-continuation params (remove-immediate-calls body)))
(($ function params body)
(make-function params (remove-immediate-calls body)))
(($ local
(($ var id ($ continuation () body)))
($ continue id ()))
(remove-immediate-calls body))
(($ local
(($ var id ($ continuation (arg) body)))
($ continue id (val)))
(make-local (list (make-var arg val))
(remove-immediate-calls body)))
(($ local bindings body)
(make-local (map remove-immediate-calls bindings)
(remove-immediate-calls body)))
(($ var id exp)
(make-var id (remove-immediate-calls exp)))
(exp exp)))