aboutsummaryrefslogtreecommitdiff
path: root/src/interp/i-spec1.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-05-25 05:55:12 +0000
committerdos-reis <gdr@axiomatics.org>2010-05-25 05:55:12 +0000
commitdd99f144ce50c2c3d2a1e1685a2d74ff533f6535 (patch)
tree51dbaca6e9ae15b2dda5cf5ecab88655f629cbca /src/interp/i-spec1.boot
parentd08100e5c7cc7ebf2c30c490033f1ccd5b57fb86 (diff)
downloadopen-axiom-dd99f144ce50c2c3d2a1e1685a2d74ff533f6535.tar.gz
* interp/g-util.boot: Implement expansion of %collect forms.
* interp/c-util.boot (middleEndExpand): Tidy. * interp/g-opt.boot (changeThrowToExit): Don't look into %collect forms. * interp/i-map.boot (getUserIdentifiersIn): Factorize. Handle %collect forms same as COLLECT forms. (findLocalVars1): Likewise. * interp/i-spec1.boot (evalCOLLECT): Now generate %collect forms. (checkForFreeVariables): Factorize. Handle %collect forms same as COLLECT forms.
Diffstat (limited to 'src/interp/i-spec1.boot')
-rw-r--r--src/interp/i-spec1.boot15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/interp/i-spec1.boot b/src/interp/i-spec1.boot
index cf2c649d..769af133 100644
--- a/src/interp/i-spec1.boot
+++ b/src/interp/i-spec1.boot
@@ -544,7 +544,7 @@ evalCOLLECT(op,[:itrl,body],m) ==
iters := [evalLoopIter itr for itr in itrl]
bod := getArgValue(body,computedMode body)
if bod isnt ['SPADCALL,:.] then bod := ['unwrap,bod]
- code := timedOptimization asTupleNewCode0(second m, ['COLLECT,:iters,bod])
+ code := timedOptimization asTupleNewCode0(second m, ["%collect",:iters,bod])
putValue(op,object(code,m))
falseFun(x) == nil
@@ -817,20 +817,13 @@ checkForFreeVariables(v,locals) ==
op in '(LAMBDA QUOTE getValueFromEnvironment) => v
op = "LETT" => -- Expands to a SETQ.
["SETF",:[checkForFreeVariables(a,locals) for a in args]]
- op = "COLLECT" => -- Introduces a new bound variable?
+ op in '(COLLECT REPEAT %collect) => -- Introduces a new bound variable?
first(args) is ["STEP",var,:.] =>
$boundVariables := [var,:$boundVariables]
- r := ["COLLECT",:[checkForFreeVariables(a,locals) for a in args]]
+ r := [op,:[checkForFreeVariables(a,locals) for a in args]]
$boundVariables := delete(var,$boundVariables)
r
- ["COLLECT",:[checkForFreeVariables(a,locals) for a in args]]
- op = "REPEAT" => -- Introduces a new bound variable?
- first(args) is ["STEP",var,:.] =>
- $boundVariables := [var,:$boundVariables]
- r := ["REPEAT",:[checkForFreeVariables(a,locals) for a in args]]
- $boundVariables := delete(var,$boundVariables)
- r
- ["REPEAT",:[checkForFreeVariables(a,locals) for a in args]]
+ [op,:[checkForFreeVariables(a,locals) for a in args]]
op = "%LET" =>
args is [var,form,name] =>
-- This is some bizarre %LET, not what one would expect in Common Lisp!