diff options
-rw-r--r-- | src/property.lisp | 4 | ||||
-rw-r--r-- | src/util.lisp | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/property.lisp b/src/property.lisp index 2a5cc74..bf62fe5 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -231,7 +231,7 @@ parsing FORMSV and pushing SETPROP keyword argument pairs to plist SLOTSV." (loop for form in (append (getf ,slotsv :check) (getf ,slotsv :apply)) - when (and (listp form) (eq 'declare (car form))) + when (form-beginning-with declare form) nconc (loop for declaration in (cdr form) @@ -343,7 +343,7 @@ You can usually use DEFPROPLIST instead of DEFPROPSPEC, which see." (setf (getf slots :unapply) '(lambda (plist) (propappunapply (eval-propspec (getf plist :propspec))))) - (when (and (listp (car forms)) (eq :desc (caar forms))) + (when (form-beginning-with :desc (car forms)) (setf (getf slots :desc) `(lambda (plist) (destructuring-bind ,lambda diff --git a/src/util.lisp b/src/util.lisp index 2d35e0c..c4b4df2 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -79,8 +79,11 @@ supported." ,@(and docstring `(,docstring)) (error ',name :format-control message :format-arguments args)))) +(defmacro form-beginning-with (sym form) + `(and (listp ,form) (eq ',sym (car ,form)))) + (defun strip-declarations (forms) - (loop while (and (listp (car forms)) (eq 'declare (caar forms))) + (loop while (form-beginning-with declare (car forms)) do (pop forms) finally (return forms))) |