1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

conditional->branch

This commit is contained in:
Ian Price 2015-06-07 17:00:48 +01:00
parent 3b32d180b1
commit f8618a522f
2 changed files with 8 additions and 8 deletions

View file

@ -12,7 +12,7 @@
make-new new
make-id id
make-refine refine
make-conditional conditional
make-branch branch
make-var var
print-statement))
@ -55,7 +55,7 @@
(define-js-type new expr)
(define-js-type id name)
(define-js-type refine id field)
(define-js-type conditional test then else)
(define-js-type branch test then else)
(define-js-type var id exp)
(define (unparse-js exp)
@ -76,7 +76,7 @@
`(id ,name))
(($ refine id field)
`(refine ,(unparse-js id) ,(unparse-js field)))
(($ conditional test then else)
(($ branch test then else)
`(if ,(unparse-js test)
(block ,@(map unparse-js then))
(block ,@(map unparse-js else))))
@ -134,7 +134,7 @@
(print-exp exp port)
(format port ";"))
(($ conditional test then else)
(($ branch test then else)
(format port "if (")
(print-exp test port)
(format port ") {")

View file

@ -47,7 +47,7 @@
(make-return (make-call (name->id k) (map compile-exp exps))))
(($ il:branch test then else)
(make-conditional (make-call (make-refine *scheme* (make-const "is_true"))
(make-branch (make-call (make-refine *scheme* (make-const "is_true"))
(list (compile-exp test)))
(list (compile-exp then))
(list (compile-exp else))))