(let ((inherited (accessor-inherited-data name defstruct)))
(cond
((not inherited)
- (stuff `(declaim (inline ,name (setf ,name))))
+ (stuff `(declaim (inline ,name ,@(unless (dsd-read-only slot)
+ `((setf ,name))))))
;; FIXME: The arguments in the next two DEFUNs should
;; be gensyms. (Otherwise e.g. if NEW-VALUE happened to
;; be the name of a special variable, things could get
;;; Return a LAMBDA form which can be used to set a slot.
(defun slot-setter-lambda-form (dd dsd)
- `(lambda (new-value instance)
- ,(funcall (nth-value 1 (slot-accessor-transforms dd dsd))
- '(dummy new-value instance))))
+ ;; KLUDGE: Evaluating the results of SLOT-ACCESSOR-TRANSFORMS needs
+ ;; a lexenv.
+ (let ((sb!c:*lexenv* (if (boundp 'sb!c:*lexenv*)
+ sb!c:*lexenv*
+ (sb!c::make-null-lexenv))))
+ `(lambda (new-value instance)
+ ,(funcall (nth-value 1 (slot-accessor-transforms dd dsd))
+ '(dummy new-value instance)))))
;;; core compile-time setup of any class with a LAYOUT, used even by
;;; !DEFSTRUCT-WITH-ALTERNATE-METACLASS weirdosities
(when (and (classoid-subclasses classoid)
(not (eq layout old-layout)))
(collect ((subs))
- (dohash (classoid layout (classoid-subclasses classoid))
- (declare (ignore layout))
- (undefine-structure classoid)
- (subs (classoid-proper-name classoid)))
- (when (subs)
- (warn "removing old subclasses of ~S:~% ~S"
- (classoid-name classoid)
- (subs))))))
+ (dohash ((classoid layout) (classoid-subclasses classoid)
+ :locked t)
+ (declare (ignore layout))
+ (undefine-structure classoid)
+ (subs (classoid-proper-name classoid)))
+ (when (subs)
+ (warn "removing old subclasses of ~S:~% ~S"
+ (classoid-name classoid)
+ (subs))))))
(t
(unless (eq (classoid-layout classoid) layout)
(register-layout layout :invalidate nil))
(let* ((accessor-name (dsd-accessor-name dsd))
(dsd-type (dsd-type dsd)))
(when accessor-name
+ (setf (info :function :structure-accessor accessor-name) dd)
(let ((inherited (accessor-inherited-data accessor-name dd)))
(cond
((not inherited)
metaclass-constructor))
(declare (type symbol predicate))
(declare (type (member structure funcallable-structure) dd-type))
- (declare (ignore boa-constructor predicate runtime-type-checks))
+ (declare (ignore boa-constructor predicate runtime-type-checks-p))
(let* ((dd (make-dd-with-alternate-metaclass
:class-name class-name
(inherits (inherits-for-structure dd)))
(%compiler-defstruct dd inherits)))
+;;; finding these beasts
+(defun find-defstruct-description (name &optional (errorp t))
+ (let ((info (layout-info (classoid-layout (find-classoid name errorp)))))
+ (if (defstruct-description-p info)
+ info
+ (when errorp
+ (error "No DEFSTRUCT-DESCRIPTION for ~S." name)))))
+
(/show0 "code/defstruct.lisp end of file")