Changeset 5255


Ignore:
Timestamp:
12/27/03 01:19:20 (17 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/Closure.java

    r5253 r5255  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Closure.java,v 1.63 2003-12-26 16:28:30 piso Exp $
     5 * $Id: Closure.java,v 1.64 2003-12-27 01:19:20 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    492492        args = processArgs(args);
    493493        Debug.assertTrue(args.length == variables.length);
    494         for (int i = 0; i < variables.length; i++)
    495             bind(variables[i], args[i], ext);
     494        for (int i = 0; i < variables.length; i++) {
     495//             bind(variables[i], args[i], ext);
     496            Symbol symbol = variables[i];
     497            if (isSpecial(symbol))
     498                thread.bindSpecial(symbol, args[i]);
     499            else
     500                ext.bind(symbol, args[i]);
     501        }
    496502        if (auxVars != null)
    497503            bindAuxVars(ext, thread);
     
    506512    }
    507513
     514    private final boolean isSpecial(Symbol symbol)
     515    {
     516        if (symbol.isSpecialVariable())
     517            return true;
     518        if (specials != null) {
     519            for (int i = specials.length; i-- > 0;) {
     520                if (symbol == specials[i])
     521                    return true;
     522            }
     523        }
     524        return false;
     525    }
     526
    508527    protected LispObject[] processArgs(LispObject[] args) throws ConditionThrowable
    509528    {
     
    518537        if (args.length < minArgs)
    519538            signal(new WrongNumberOfArgumentsException(this));
     539        // The bindings established here are lost when this function returns.
     540        // They are used only in the evaluation of initforms for optional and
     541        // keyword arguments.
    520542        Environment oldDynEnv = thread.getDynamicEnvironment();
    521543        Environment ext = new Environment(environment);
Note: See TracChangeset for help on using the changeset viewer.