Changeset 4833


Ignore:
Timestamp:
11/19/03 13:43:42 (18 years ago)
Author:
piso
Message:

Fixed BOUNDP to work correctly with PROGV.

File:
1 edited

Legend:

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

    r4830 r4833  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.502 2003-11-19 02:34:32 piso Exp $
     5 * $Id: Primitives.java,v 1.503 2003-11-19 13:43:42 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    776776
    777777    // ### boundp
    778     private static final Primitive1 BOUNDP = new Primitive1("boundp") {
     778    // Determines only whether a symbol has a value in the global environment;
     779    // any lexical bindings are ignored.
     780    private static final Primitive1 BOUNDP = new Primitive1("boundp")
     781    {
    779782        public LispObject execute(LispObject obj) throws ConditionThrowable
    780783        {
    781             if (obj == NIL)
    782                 return T;
    783784            Symbol symbol = checkSymbol(obj);
    784             if (LispThread.currentThread().lookupSpecial(symbol) != null)
    785                 return T;
     785            Environment dynEnv =
     786                LispThread.currentThread().getDynamicEnvironment();
     787            // PROGV: "If too few values are supplied, the remaining symbols
     788            // are bound and then made to have no value." So BOUNDP must
     789            // explicitly check for a binding with no value.
     790            Binding binding = dynEnv.getBinding(symbol);
     791            if (binding != null)
     792                return binding.value != null ? T : NIL;
     793            // No binding.
    786794            return symbol.getSymbolValue() != null ? T : NIL;
    787795        }
Note: See TracChangeset for help on using the changeset viewer.