diff options
author | dos-reis <gdr@axiomatics.org> | 2010-06-07 18:15:49 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-06-07 18:15:49 +0000 |
commit | 6aca99e6211a8fe97a8bb84d2bc85f9900f35315 (patch) | |
tree | 286e2d41adb25c0e1fdfb25aaddb5267e7ef1dc7 /src | |
parent | 7422a29157bf7de1742eade45590dbed7d0d4a12 (diff) | |
download | open-axiom-6aca99e6211a8fe97a8bb84d2bc85f9900f35315.tar.gz |
* interp/compiler.boot (finishLambdaExpression): Bind escaped
variables with LET-form instead of assignment.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/interp/compiler.boot | 17 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5a3bf037..16f72544 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2010-06-07 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/compiler.boot (finishLambdaExpression): Bind escaped + variables with LET-form instead of assignment. + +2010-06-07 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/compiler.boot (replaceExitEtc): Replace TAGGEDreturn with %return. * interp/g-opt.boot (removeNeedlessThrow): New. diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 16222b24..6323bf51 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -329,24 +329,23 @@ finishLambdaExpression(expr is ["LAMBDA",vars,.],env) == frees is [[var,:.]] => vec := var ["LAMBDA",[:vars,var],:CDDR expandedFunction] - scode := nil + scode := nil -- list of multiple used variables, need local bindings. slist := nil -- list of single used variables, no local bindings. - locals := nil -- list of multiple used variables, need local bindings. i := -1 for v in frees repeat i := i+1 vec := [first v,:vec] rest v = 1 => slist := [[first v,"getShellEntry","$$",i],:slist] - scode := [['SETQ,first v,["getShellEntry","$$",i]],:scode] - locals := [first v,:locals] + scode := [[first v,["getShellEntry","$$",i]],:scode] body := slist => SUBLISNQ(slist,CDDR expandedFunction) CDDR expandedFunction - if locals then - if body is [["DECLARE",:.],:.] then - body := [first body,["PROG",locals,:scode, - ["RETURN",["PROGN",:rest body]]]] - else body := [["PROG",locals,:scode,["RETURN",["PROGN",:body]]]] + if scode ~= nil then + body := + body is [["DECLARE",:.],:.] => + [first body,["PROG",nreverse scode, + ["RETURN",["PROGN",:rest body]]]] + [["LET",nreverse scode,:body]] vec := ["VECTOR",:nreverse vec] ["LAMBDA",[:vars,"$$"],:body] fname := ["CLOSEDFN",expandedFunction] --Like QUOTE, but gets compiled |