Changeset 12125


Ignore:
Timestamp:
08/30/09 20:21:35 (12 years ago)
Author:
ehuelsmann
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/StructureClass.java

    r12122 r12125  
    9393        {
    9494            Symbol symbol = checkSymbol(first);
     95            LispClass existingClass = LispClass.findClass(symbol);
     96
     97            if (existingClass instanceof StructureClass)
     98                // DEFSTRUCT-REDEFINITION write-up
     99                // states the effects from re-definition are undefined
     100                // we punt: our compiler bootstrapping depends on
     101                // the class not being redefined (remaining in the
     102                // same location in the class hierarchy)
     103                return existingClass;
     104
     105
     106
    95107            LispObject directSlots = checkList(second);
    96108            LispObject slots = checkList(third);
    97109            Symbol include = checkSymbol(fourth);
    98             LispClass existingClass = LispClass.findClass(symbol);
    99             StructureClass c;
    100110
    101             if (existingClass instanceof StructureClass)
    102                 // Change the existing class definition if there is one.
    103                 // The compiler has this scenario, where it is first loaded
    104                 // and subsequently run through the file compiler - which
    105                 // re-creates the same structure and breaks the inheritance
    106                 // if we don't re-use the existing class. Reusing the
    107                 // existing class is alright in this case, since we're
    108                 // recreating the same class.
    109                 // Redefinition of structures is undefined in the CLHS.
    110                 // As per the DEFSTRUCT-REDEFINITION it is allowed, but
    111                 // consequences are undefined.
    112                 c = (StructureClass)existingClass;
    113             else
    114                 c = new StructureClass(symbol);
     111            StructureClass c = new StructureClass(symbol);
    115112            if (include != NIL) {
    116113                LispClass includedClass = LispClass.findClass(include);
Note: See TracChangeset for help on using the changeset viewer.