src/class-output.lisp: Leave `*instance-class*' unbound at top-level.
[sod] / src / builtin.lisp
index be9a8e5..d07f539 100644 (file)
@@ -279,7 +279,7 @@ static const SodClass *const ~A__cpl[] = {
 
 (definst suppliedp-struct (stream) (flags var)
   (format stream
-         "~@<struct { ~2I~_~{unsigned ~A : 1;~^ ~_~} ~I~_} ~A;~:>"
+         "~@<struct { ~2I~_~{unsigned ~A: 1;~^ ~_~} ~I~_} ~A;~:>"
          flags var))
 
 ;; Initialization.
@@ -294,8 +294,8 @@ static const SodClass *const ~A__cpl[] = {
     ((message initialization-message))
   'initialization-effective-method)
 
-(defmethod method-keyword-argument-lists
-    ((method initialization-effective-method) direct-methods state)
+(defmethod sod-message-keyword-argument-lists
+    ((message initialization-message) (class sod-class) direct-methods state)
   (append (call-next-method)
          (mapcan (lambda (class)
                    (let* ((initargs (sod-class-initargs class))
@@ -317,8 +317,7 @@ static const SodClass *const ~A__cpl[] = {
                                         (report-inheritance-path
                                          state class))
                                       arglist)))))
-                 (sod-class-precedence-list
-                  (effective-method-class method)))))
+                 (sod-class-precedence-list class))))
 
 (defmethod lifecycle-method-kernel
     ((method initialization-effective-method) codegen target)
@@ -423,19 +422,20 @@ static const SodClass *const ~A__cpl[] = {
                (when (or init initargs)
                  (focus-this-class)
                  (let* ((slot-type (sod-slot-type dslot))
-                        (slot-default (sod-initializer-value init))
                         (target (format nil "~A.~A"
                                         isl (sod-slot-name dslot)))
-                        (initinst (set-from-initializer target
-                                                        slot-type
-                                                        slot-default)))
+                        (initinst (and init
+                                       (set-from-initializer
+                                        target slot-type
+                                        (sod-initializer-value init)))))
 
                    ;; If there are applicable initialization arguments,
                    ;; check to see whether they were supplied.
                    (dolist (initarg (reverse (remove-duplicates
                                               initargs
                                               :key #'sod-initarg-name
-                                              :test #'string=)))
+                                              :test #'string=
+                                              :from-end t)))
                      (let ((arg-name (sod-initarg-name initarg)))
                        (setf initinst (make-if-inst
                                        (format nil "suppliedp.~A" arg-name)
@@ -517,9 +517,11 @@ static const SodClass *const ~A__cpl[] = {
    instance of `SodClass', and `SodClass' is a subclass of `SodObject' (and
    an instance of itself)."
   (let* ((sod-object (make-sod-class "SodObject" nil
-                                    (make-property-set :nick 'obj)))
+                                    (make-property-set :nick 'obj
+                                                       :%bootstrapping t)))
         (sod-class (make-sod-class "SodClass" (list sod-object)
-                                   (make-property-set :nick 'cls)))
+                                   (make-property-set :nick 'cls
+                                                      :%bootstrapping t)))
         (classes (list sod-object sod-class)))
 
     ;; Attach the built-in messages.