aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/g-opt.boot2
-rw-r--r--src/interp/g-util.boot10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 23f53c16..1e2703d7 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -239,6 +239,8 @@ removeSeq! x == walkWith!(x,function f) where
inlineLocals! x == walkWith!(x,function f) where
f x ==
+ x is ['%bind,[[y,a]],z] and gensym? y and numOfOccurencesOf(y,z) = 1 =>
+ resetTo(x,f substitute!(a,y,z))
x is ['%bind,inits,:.] =>
kept := nil
while inits is [u,:inits] repeat
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 8313c000..3b1782f9 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -96,15 +96,19 @@ splitAssignments! u == main(u,nil) where
++ an %exit-form in it. In particular, it should be called
++ (if at all) before any call to simplifyVMForm.
spliceSeqArgs l ==
- atomic? l => l
+ l = nil => l
s := first l
s is ['%seq,:.] =>
stmts := spliceSeqArgs s.args
stmts = nil => spliceSeqArgs rest l
lastNode(stmts).rest := spliceSeqArgs rest l
stmts
- s is ['%LET,x,y] and (stmts := splitAssignments y) =>
- lastNode(stmts).rest := [['%LET,x,second y],:spliceSeqArgs rest l]
+ s is ['%scope,tag,['%seq,:ys,['%leave,=tag,z]]] and hasNoLeave?(ys,tag) =>
+ stmts := spliceSeqArgs [:ys,z]
+ lastNode(stmts).rest := spliceSeqArgs rest l
+ stmts
+ s is ['%LET,:.] and (stmts := splitAssignments! s) =>
+ lastNode(stmts).rest := [s,:spliceSeqArgs rest l]
stmts
rest l = nil => l
l.rest := spliceSeqArgs rest l