aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-02-12 01:11:29 +0000
committerdos-reis <gdr@axiomatics.org>2011-02-12 01:11:29 +0000
commit0ac37df817059cca37fd38f0512f3f6f3e269833 (patch)
tree3a66e9648606e5f4b88d95361061fd3a27077a81 /src/interp
parentf80c643a39ac6a3870e6a3b7cc967b8e6a3d0915 (diff)
downloadopen-axiom-0ac37df817059cca37fd38f0512f3f6f3e269833.tar.gz
* interp/g-opt.boot (changeVariableDefinitionToStore): Tidy.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/g-opt.boot34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index d777bc58..4ff87150 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -70,14 +70,36 @@ emitIndirectCall(fn,args,x) ==
++ updated as opposed to being defined. `vars' is the list of
++ all variable definitions in scope.
changeVariableDefinitionToStore(form,vars) ==
- atomic? form => nil
+ atomic? form or form.op is 'CLOSEDFN => vars
form is ['%LET,v,expr] =>
- changeVariableDefinitionToStore(expr,vars)
- if v in vars then form.op := '%store
- for x in form repeat
- changeVariableDefinitionToStore(x,vars)
- x is ['%LET,v,:.] and not (v in vars) =>
+ vars := changeVariableDefinitionToStore(expr,vars)
+ if v in vars then
+ form.op := '%store
+ else
vars := [v,:vars]
+ vars
+ form.op is '%when =>
+ for clause in form.args repeat
+ -- variable defined in clause predicates are visible
+ -- subsequent predicates
+ vars := changeVariableDefinitionToStore(first clause,vars)
+ -- but those defined in branches are local.
+ changeVariableDefinitionToStore(rest clause,vars)
+ vars
+ -- local bindings are, well, local.
+ form.op in '(%bind LET) =>
+ vars' := vars
+ for [v,init] in second form repeat
+ vars' := changeVariableDefinitionToStore(init,vars')
+ vars' := [v,:vars']
+ changeVariableDefinitionToStore(third form,vars')
+ vars
+ form.op in $AbstractionOperator =>
+ changeVariableDefinitionToStore(third form,[:second form,:vars])
+ vars
+ for x in form repeat
+ vars := changeVariableDefinitionToStore(x,vars)
+ vars
++ Return true if `x' contains control transfer to a point outside itself.
jumpToToplevel? x ==