Commit 8a20c80a authored by Guy Watson's avatar Guy Watson
Browse files

Try to make the loopvar ahead of time

parent 5ef08c1d
......@@ -165,7 +165,10 @@
#;[GlobalGet (hash 'name (fresh-var-name "$global_"))]
#;[GlobalSet (hash 'name (fresh-var-name "$global_"))]
;; implement these with the upcoming custom name changes
[ForLoop (let* ([global-name (ast-child 'name (ast-child 'loopvar (current-hole)))]
[ForLoop (let* ([proto-loopvar (make-fresh-node 'GlobalSet
(hash 'val (make-fresh-node 'LiteralInt)
'expr (make-fresh-node 'LiteralInt)))]
[global-name (ast-child 'name proto-loopvar)]
[global-get (make-fresh-node 'GlobalGet
(hash 'name global-name))]
[zero (make-fresh-node 'LiteralInt
......@@ -180,9 +183,7 @@
'r global-get))]
[branch (make-fresh-node 'BranchIf
(hash 'cond comparison))])
(hash 'loopvar (make-fresh-node 'GlobalSet
(hash 'val (make-fresh-node 'LiteralInt)
'expr (make-fresh-node 'LiteralInt))) ;;make a dummy int
(hash 'loopvar proto-loopvar
'iter (make-fresh-node 'GlobalSet
(hash 'val iteration
'name global-name
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment