Changeset 8649


Ignore:
Timestamp:
02/27/05 20:01:57 (16 years ago)
Author:
piso
Message:

New FunctionBinding? class.

File:
1 edited

Legend:

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

    r8105 r8649  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: Environment.java,v 1.18 2004-11-04 18:35:41 piso Exp $
     5 * $Id: Environment.java,v 1.19 2005-02-27 20:01:57 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2525{
    2626    private Binding vars;
    27     private Binding functions;
     27    private FunctionBinding lastFunctionBinding;
    2828    private Binding blocks;
    2929    private Binding tags;
     
    3535        if (parent != null) {
    3636            vars = parent.vars;
    37             functions = parent.functions;
     37            lastFunctionBinding = parent.lastFunctionBinding;
    3838            blocks = parent.blocks;
    3939            tags = parent.tags;
     
    4747        if (parent != null) {
    4848            vars = parent.vars;
    49             functions = parent.functions;
     49            lastFunctionBinding = parent.lastFunctionBinding;
    5050            blocks = parent.blocks;
    5151            tags = parent.tags;
     
    5656    public boolean isEmpty()
    5757    {
    58         if (functions != null)
     58        if (lastFunctionBinding != null)
    5959            return false;
    6060        if (vars != null) {
     
    9999    }
    100100
    101     // Functional bindings.
    102     public void bindFunctional(LispObject name, LispObject value)
    103     {
    104         functions = new Binding(name, value, functions);
    105     }
    106 
    107     public LispObject lookupFunctional(LispObject name)
     101    // Function bindings.
     102    public void addFunctionBinding(LispObject name, LispObject value)
     103    {
     104        lastFunctionBinding =
     105            new FunctionBinding(name, value, lastFunctionBinding);
     106    }
     107
     108    public LispObject lookupFunction(LispObject name)
    108109        throws ConditionThrowable
    109110    {
    110         Binding binding = functions;
     111        FunctionBinding binding = lastFunctionBinding;
    111112        if (name instanceof Symbol) {
    112113            while (binding != null) {
    113                 if (binding.symbol == name)
     114                if (binding.name == name)
    114115                    return binding.value;
    115116                binding = binding.next;
     
    120121        if (name instanceof Cons) {
    121122            while (binding != null) {
    122                 if (binding.symbol.equal(name))
     123                if (binding.name.equal(name))
    123124                    return binding.value;
    124125                binding = binding.next;
Note: See TracChangeset for help on using the changeset viewer.