Commit e4ac4507 authored by Noam Postavsky's avatar Noam Postavsky

Define struct predicate before acccesors

The accessor functions use the predicate function, which causes problems
when reloading after unload-feature: the compiler-macro property is
still present on the predicate symbol, and the compiler fails to find
the definition when trying to inline it into the accessor
function (Bug#25088).

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Move predicate definition
before field accessor definitions.
parent 08decbd0
......@@ -2687,6 +2687,14 @@ non-nil value, that slot cannot be set via `setf'.
(= safety 1))
(cons 'and (cl-cdddr pred-form))
`(,predicate cl-x))))
(when pred-form
(push `(cl-defsubst ,predicate (cl-x)
(declare (side-effect-free error-free))
,(if (eq (car pred-form) 'and)
(append pred-form '(t))
`(and ,pred-form t)))
forms)
(push `(put ',name 'cl-deftype-satisfies ',predicate) forms))
(let ((pos 0) (descp descs))
(while descp
(let* ((desc (pop descp))
......@@ -2741,14 +2749,6 @@ non-nil value, that slot cannot be set via `setf'.
(setq pos (1+ pos))))
(setq slots (nreverse slots)
defaults (nreverse defaults))
(when pred-form
(push `(cl-defsubst ,predicate (cl-x)
(declare (side-effect-free error-free))
,(if (eq (car pred-form) 'and)
(append pred-form '(t))
`(and ,pred-form t)))
forms)
(push `(put ',name 'cl-deftype-satisfies ',predicate) forms))
(and copier
(push `(defalias ',copier #'copy-sequence) forms))
(if constructor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment