aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog7
-rw-r--r--src/interp/g-util.boot9
2 files changed, 12 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 542be41b..d3faaa18 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2010-06-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/g-util.boot (expandLoop): Now take all arguments as a
+ single %loop form.
+ (expandCollect): Adjust call.
+ (expandRepeat): Likewise.
+
+2010-06-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/g-opt.boot (optCollectVector): Generare %collect form,
not COLLECT.
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 9bfb08f0..7c8945c5 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -185,7 +185,7 @@ expandIterators iters ==
it is ["%init",var,val] => expandInit(var,val)
nil
-expandLoop(iters,body,ret) ==
+expandLoop ['%loop,:iters,body,ret] ==
itersCode := expandIterators iters
itersCode = "failed" => systemErrorHere ["expandLoop",iters]
body := middleEndExpand body
@@ -215,14 +215,14 @@ expandCollect ['%collect,:iters,body] ==
-- Initialize the variable holding the result; expand as
-- if ordinary loop. But don't forget we built the result
-- in reverse order.
- expandLoop([:iters,["%init",val,nil]],body,["NREVERSE",val])
+ expandLoop ['%loop,:iters,["%init",val,nil],body,["NREVERSE",val]]
++ Generate code for plain loop.
expandRepeat ["%repeat",:iters,body] ==
- expandLoop(iters,body,["voidValue"])
+ expandLoop ['%loop,:iters,body,["voidValue"]]
expandReduce ['%reduce,:iters,val,body] ==
- expandLoop(iters,body,val)
+ expandLoop ['%loop,:iters,body,val]
expandReturn(x is ['%return,.,y]) ==
$FUNNAME = nil => systemErrorHere ['expandReturn,x]
@@ -348,6 +348,7 @@ for x in [
['%collect,:function expandCollect],
["%repeat",:function expandRepeat],
['%reduce, :function expandReduce],
+ ['%loop, :function expandLoop],
['%return, :function expandReturn],
["%eq",:function expandEq],