src/module-{proto,impl}.lisp, etc.: Don't output erroneous modules.
[sod] / src / class-layout-impl.lisp
index d6b3e6d..119996e 100644 (file)
                 :initializer (find-slot-initializer class slot)
                 :initargs (find-slot-initargs class slot)))
 
+(defmethod find-class-initializer ((slot effective-slot) (class sod-class))
+  (let ((dslot (effective-slot-direct-slot slot)))
+    (or (some (lambda (super)
+               (find dslot (sod-class-class-initializers super)
+                     :key #'sod-initializer-slot))
+             (sod-class-precedence-list class))
+       (effective-slot-initializer slot))))
+
 ;;;--------------------------------------------------------------------------
 ;;; Special-purpose slot objects.
 
            (compute-vtable class (reverse chain)))
          (sod-class-chains class)))
 
+;;;--------------------------------------------------------------------------
+;;; Layout interface.
+
+;; Just arrange to populate the necessary slots on demand.
+(flet ((check-class-is-finalized (class)
+        (unless (eq (sod-class-state class) :finalized)
+          (error "Class ~S is not finalized" class))))
+    (macrolet ((define-layout-slot (slot (class) &body body)
+              `(define-on-demand-slot sod-class ,slot (,class)
+                 (check-class-is-finalized ,class)
+                 ,@body)))
+    (define-layout-slot %ilayout (class)
+      (compute-ilayout class))
+    (define-layout-slot effective-methods (class)
+      (compute-effective-methods class))
+    (define-layout-slot vtables (class)
+      (compute-vtables class))))
+
 ;;;----- That's all, folks --------------------------------------------------