[armedbear-cvs] r12287 - trunk/abcl/src/org/armedbear/lisp

Ville Voutilainen vvoutilainen at common-lisp.net
Sun Nov 29 20:23:09 UTC 2009


Author: vvoutilainen
Date: Sun Nov 29 15:23:08 2009
New Revision: 12287

Log:
Make LispObject.push() final.


Modified:
   trunk/abcl/src/org/armedbear/lisp/Cons.java
   trunk/abcl/src/org/armedbear/lisp/LispObject.java
   trunk/abcl/src/org/armedbear/lisp/Nil.java

Modified: trunk/abcl/src/org/armedbear/lisp/Cons.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Cons.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Cons.java	Sun Nov 29 15:23:08 2009
@@ -166,12 +166,6 @@
   }
 
   @Override
-  public final LispObject push(LispObject obj)
-  {
-    return new Cons(obj, this);
-  }
-
-  @Override
   public final int sxhash()
   {
     return computeHash(this, 4);

Modified: trunk/abcl/src/org/armedbear/lisp/LispObject.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispObject.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/LispObject.java	Sun Nov 29 15:23:08 2009
@@ -198,8 +198,13 @@
     return type_error(this, Symbol.LIST);
   }
 
-  public LispObject push(LispObject obj)
+  public final LispObject push(LispObject obj)
   {
+    if (this instanceof Cons) {
+      return new Cons(obj, this);
+    } else if (this instanceof Nil) {
+      return new Cons(obj);
+    }
     return type_error(this, Symbol.LIST);
   }
 

Modified: trunk/abcl/src/org/armedbear/lisp/Nil.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Nil.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Nil.java	Sun Nov 29 15:23:08 2009
@@ -138,12 +138,6 @@
     }
 
     @Override
-    public LispObject push(LispObject obj)
-    {
-        return new Cons(obj);
-    }
-
-    @Override
     public LispObject NTH(int index)
     {
         if (index < 0)




More information about the armedbear-cvs mailing list