Changeset 8638


Ignore:
Timestamp:
02/26/05 17:28:15 (16 years ago)
Author:
piso
Message:

safeSymbolValue()

File:
1 edited

Legend:

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

    r8611 r8638  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: LispThread.java,v 1.74 2005-02-20 14:38:59 piso Exp $
     5 * $Id: LispThread.java,v 1.75 2005-02-26 17:28:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    346346        symbol.setSymbolValue(value);
    347347        return value;
     348    }
     349
     350    // Returns symbol value or NIL if unbound.
     351    public final LispObject safeSymbolValue(Symbol symbol)
     352    {
     353        Binding binding = lastSpecialBinding;
     354        while (binding != null) {
     355            if (binding.symbol == symbol)
     356                return binding.value;
     357            binding = binding.next;
     358        }
     359        LispObject value = symbol.getSymbolValue();
     360        return value != null ? value : NIL;
    348361    }
    349362
Note: See TracChangeset for help on using the changeset viewer.