* Fixed scope of named let variables, fixing the bug described here:

http://groups.google.com/groups?selm=871zemtmd4.fsf%40app.dial.idiom.com


git-svn-id: svn://svn.zoy.org/elk/trunk@185 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-24 16:32:46 +00:00
parent ce02b05888
commit 8717cc8a81
2 changed files with 6 additions and 4 deletions

3
BUGS
View File

@ -36,7 +36,4 @@ Generational/Incremental Garbage Collector
o The percentage displayed at the end of a GC run is sometimes wrong. o The percentage displayed at the end of a GC run is sometimes wrong.
o The scope of the name of a named let is wrong, as explained in
http://groups.google.com/groups?selm=871zemtmd4.fsf%40app.dial.idiom.com
o Almost no Unix commands work under Win32, and they are badly disabled. o Almost no Unix commands work under Win32, and they are badly disabled.

View File

@ -456,6 +456,7 @@ Object Named_Let (Object argl) {
(void)P_Set_Cdr (vtail, cell); (void)P_Set_Cdr (vtail, cell);
vtail = cell; vtail = cell;
} }
/* Create a new environment to protect our named let variable */
Push_Frame (Add_Binding (Null, Car (argl), Null)); Push_Frame (Add_Binding (Null, Car (argl), Null));
tail = Cons (vlist, Cdr (Cdr (argl))); tail = Cons (vlist, Cdr (Cdr (argl)));
if (Nullp (Cdr (tail))) if (Nullp (Cdr (tail)))
@ -466,8 +467,12 @@ Object Named_Let (Object argl) {
Cdr (b) = tail; Cdr (b) = tail;
SYMBOL(Car (argl))->value = tail; SYMBOL(Car (argl))->value = tail;
TC_Enable; TC_Enable;
tail = Funcall (tail, flist, 1); /* Restore environment before calling the function */
Pop_Frame (); Pop_Frame ();
/* vlist: list of variables
* flist: list of initial values
* tail: our new lambda function */
tail = Funcall (tail, flist, 1);
GC_Unlink; GC_Unlink;
return tail; return tail;
} }