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

Erik Huelsmann ehuelsmann at common-lisp.net
Fri Aug 28 07:52:49 UTC 2009


Author: ehuelsmann
Date: Fri Aug 28 03:52:48 2009
New Revision: 12122

Log:
Allow file-compilation of already-defined structure classes
in order to support the bootstrapping process.

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	Fri Aug 28 03:52:48 2009
@@ -95,7 +95,23 @@
             LispObject directSlots = checkList(second);
             LispObject slots = checkList(third);
             Symbol include = checkSymbol(fourth);
-            StructureClass c = new StructureClass(symbol);
+            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);
             if (include != NIL) {
                 LispClass includedClass = LispClass.findClass(include);
                 if (includedClass == null)




More information about the armedbear-cvs mailing list