chiark / gitweb /
vars.am: Add missing `-M' in suffix-rules command.
[sod] / src / class-make-impl.lisp
index 5fe9de762c40d5b63b86bc5e1a1332f5e46d2ecc..b96d830cb60eedd4047cc61a7a87f98d971f7be7 100644 (file)
@@ -115,7 +115,7 @@ (defmethod shared-initialize :after ((slot sod-slot) slot-names &key pset)
 ;;; Slot initializers.
 
 (defmethod make-sod-instance-initializer
 ;;; Slot initializers.
 
 (defmethod make-sod-instance-initializer
-    ((class sod-class) nick name value pset &key location)
+    ((class sod-class) nick name value pset &key location inhibit-initargs)
   (with-default-error-location (location)
     (let* ((slot (find-instance-slot-by-name class nick name))
           (initarg-name (get-property pset :initarg :id))
   (with-default-error-location (location)
     (let* ((slot (find-instance-slot-by-name class nick name))
           (initarg-name (get-property pset :initarg :id))
@@ -126,7 +126,7 @@ (defmethod make-sod-instance-initializer
       (with-slots (instance-initializers) class
        (unless (or initarg-name initializer)
          (error "Slot initializer declaration with no effect"))
       (with-slots (instance-initializers) class
        (unless (or initarg-name initializer)
          (error "Slot initializer declaration with no effect"))
-       (when initarg-name
+       (when (and initarg-name (not inhibit-initargs))
          (make-sod-slot-initarg-using-slot class initarg-name slot pset
                                            :location location))
        (when initializer
          (make-sod-slot-initarg-using-slot class initarg-name slot pset
                                            :location location))
        (when initializer
@@ -183,11 +183,15 @@ (defmethod make-sod-slot-initarg-using-slot
     ((class sod-class) name (slot sod-slot) pset &key location)
   (with-slots (initargs) class
     (with-slots ((type %type)) slot
     ((class sod-class) name (slot sod-slot) pset &key location)
   (with-slots (initargs) class
     (with-slots ((type %type)) slot
-      (push (make-instance (get-property pset :initarg-class :symbol
-                                        'sod-slot-initarg)
-                          :location (file-location location)
-                          :class class :name name :type type :slot slot)
-           initargs))))
+      (setf initargs
+           (append initargs
+                   (cons (make-instance (get-property pset :initarg-class
+                                                      :symbol
+                                                      'sod-slot-initarg)
+                                        :location (file-location location)
+                                        :class class :name name
+                                        :type type :slot slot)
+                         nil))))))
 
 (defmethod sod-initarg-default ((initarg sod-initarg)) nil)
 
 
 (defmethod sod-initarg-default ((initarg sod-initarg)) nil)