Changeset 11940


Ignore:
Timestamp:
05/23/09 22:44:26 (14 years ago)
Author:
astalla
Message:

Fixed a bug in interpreted let* and do*: the environment used for bindings
was a single one, shared with all the initforms and the body. This caused
closures in initforms to capture newly-introduced bindings.
The fix amounts to creating a new extended environment for every binding.
In passing a typo was fixed in java.lisp.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Do.java

    r11772 r11940  
    102102    body = bodyAndDecls.car();
    103103
    104     final Environment ext = new Environment(env);
     104    Environment ext = new Environment(env);
    105105    for (int i = 0; i < numvars; i++)
    106106      {
    107107        Symbol var = vars[i];
    108108        LispObject value = eval(initforms[i], (sequential ? ext : env), thread);
     109  ext = new Environment(ext);
    109110        if (specials != NIL && memq(var, specials))
    110111            thread.bindSpecial(var, value);
  • trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java

    r11772 r11940  
    144144                value = NIL;
    145145              }
    146             if (sequential)
     146            if (sequential) {
     147        ext = new Environment(ext);
    147148              bindArg(specials, symbol, value, ext, thread);
     149      }
    148150            else
    149151                nonSequentialVars.add(new Cons(symbol, value));
  • trunk/abcl/src/org/armedbear/lisp/java.lisp

    r11590 r11940  
    289289      `(java:jclass ,(jcall (jmethod "java.lang.Class" "getName") object)))
    290290     (t
    291       (error "Unknown load-from for ~A" class-name)))))
     291      (error "Unknown load-form for ~A" class-name)))))
    292292
    293293(defun jproperty-value (obj prop)
Note: See TracChangeset for help on using the changeset viewer.