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

Erik Huelsmann ehuelsmann at common-lisp.net
Sun Aug 30 20:21:38 UTC 2009


Author: ehuelsmann
Date: Sun Aug 30 16:21:35 2009
New Revision: 12125

Log:
Followup to r12122: Don't redefine the same class,
instead disallow redefinition, returning the
pre-existing class.

Modified:
   trunk/abcl/src/org/armedbear/lisp/StructureClass.java

Modified: trunk/abcl/src/org/armedbear/lisp/StructureClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/StructureClass.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/StructureClass.java	Sun Aug 30 16:21:35 2009
@@ -92,26 +92,23 @@
             throws ConditionThrowable
         {
             Symbol symbol = checkSymbol(first);
+            LispClass existingClass = LispClass.findClass(symbol);
+
+            if (existingClass instanceof StructureClass)
+                // DEFSTRUCT-REDEFINITION write-up
+                // states the effects from re-definition are undefined
+                // we punt: our compiler bootstrapping depends on
+                // the class not being redefined (remaining in the
+                // same location in the class hierarchy)
+                return existingClass;
+
+
+
             LispObject directSlots = checkList(second);
             LispObject slots = checkList(third);
             Symbol include = checkSymbol(fourth);
-            LispClass existingClass = LispClass.findClass(symbol);
-            StructureClass c;
 
-            if (existingClass instanceof StructureClass)
-                // Change the existing class definition if there is one.
-                // The compiler has this scenario, where it is first loaded
-                // and subsequently run through the file compiler - which
-                // re-creates the same structure and breaks the inheritance
-                // if we don't re-use the existing class. Reusing the
-                // existing class is alright in this case, since we're
-                // recreating the same class.
-                // Redefinition of structures is undefined in the CLHS.
-                // As per the DEFSTRUCT-REDEFINITION it is allowed, but
-                // consequences are undefined.
-                c = (StructureClass)existingClass;
-            else
-                c = new StructureClass(symbol);
+            StructureClass c = new StructureClass(symbol);
             if (include != NIL) {
                 LispClass includedClass = LispClass.findClass(include);
                 if (includedClass == null)




More information about the armedbear-cvs mailing list