Changeset 750


Ignore:
Timestamp:
Apr 2, 2004, 9:44:35 PM (21 years ago)
Author:
Gary Byers
Message:

Check for circularities when checking for forward-referenced superclasses.
Redefine %ADD-METHOD as ADD-METHOD when we're able to.
ENSURE-CLASS-USING-CLASS of a forward-referenced class passes initargs
to CHANGE-CLASS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-clos.lisp

    r732 r750  
    413413
    414414;;; Standard classes are finalized if they have a wrapper and that
    415 ;;; wrapper as an instance-slots vector; that implies that
     415;;; wrapper has an instance-slots vector; that implies that
    416416;;; both UPDATE-CPL and UPDATE-SLOTS have been called on the class.
    417417(defmethod class-finalized-p ((class std-class))
     
    464464                  (unless (eq (%slot-definition-name (car sup-slotds))
    465465                              (%slot-definition-name (car primary-slotds)))
    466                     (format t "~&name of sup-slotds = ~s, name of prim = ~s"
    467                             (%slot-definition-name (car sup-slotds))
    468                             (%slot-definition-name (car primary-slotds)))
    469466                    (error "While initializing ~s:~%~
    470467                            attempt to mix incompatible primary classes:~%~
     
    500497
    501498
    502 (defun class-has-a-forward-referenced-superclass-p (class)
    503   (or (if (forward-referenced-class-p class) class)
    504       (dolist (s (%class-direct-superclasses class))
    505         (let* ((fwdref (class-has-a-forward-referenced-superclass-p s)))
    506           (when fwdref (return fwdref))))))
     499(defun class-has-a-forward-referenced-superclass-p (original)
     500  (labels ((scan-forward-refs (class seen)
     501             (unless (memq class seen)
     502               (or (if (forward-referenced-class-p class) class)
     503                   (progn
     504                     (push class seen)
     505                     (dolist (s (%class-direct-superclasses class))
     506                       (when (eq s original)
     507                         (error "circular class hierarchy: the class ~s is a superclass of at least one of its superclasses (~s)." original class))
     508                       (let* ((fwdref (scan-forward-refs s seen)))
     509                         (when fwdref (return fwdref)))))))))
     510    (scan-forward-refs original ())))
    507511
    508512
     
    538542    (finalize-inheritance class)
    539543    (return-from update-class))
    540 
    541544  (when (or finalizep
    542545            (class-finalized-p class)
     
    671674  (multiple-value-bind (metaclass initargs)
    672675      (ensure-class-metaclass-and-initargs class keys)
    673     (change-class class metaclass)
     676    (apply #'change-class class metaclass initargs)
    674677    (apply #'reinitialize-instance class initargs)
    675678    (setf (find-class name) class)))
     
    12281231      (fdefinition '%method-lambda-list) #'method-lambda-list
    12291232      )
     1233
     1234(setf (fdefinition '%add-method) #'add-method)
    12301235                   
    12311236     
Note: See TracChangeset for help on using the changeset viewer.