X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fmacroexpand.lisp;h=f351784667f0028a0d71c12869b4b98dd21a258a;hb=2f2fad31a662b5387376003fab7ef328b4ac9063;hp=b1049bda04cba667415100c6d554b9d851ca33dc;hpb=b0b168c08b31a748150f404398af754f26fd4813;p=sbcl.git diff --git a/src/code/macroexpand.lisp b/src/code/macroexpand.lisp index b1049bd..f351784 100644 --- a/src/code/macroexpand.lisp +++ b/src/code/macroexpand.lisp @@ -15,7 +15,7 @@ (defun sb!xc:special-operator-p (symbol) #!+sb-doc - "If the symbol globally names a special form, returns T, otherwise NIL." + "If the symbol globally names a special form, return T, otherwise NIL." (declare (symbol symbol)) (eq (info :function :kind symbol) :special-form)) @@ -31,9 +31,9 @@ (declaim (ftype (function (t &optional (or null sb!c::lexenv))) sb!xc:macroexpand-1)) (defun sb!xc:macroexpand-1 (form &optional env) #!+sb-doc - "If form is a macro (or symbol macro), expands it once. Returns two values, + "If form is a macro (or symbol macro), expand it once. Return two values, the expanded form and a T-or-NIL flag indicating whether the form was, in - fact, a macro. Env is the lexical environment to expand in, which defaults + fact, a macro. ENV is the lexical environment to expand in, which defaults to the null environment." (cond ((and (consp form) (symbolp (car form))) (let ((def (sb!xc:macro-function (car form) env))) @@ -56,10 +56,13 @@ ((symbolp form) (let* ((venv (when env (sb!c::lexenv-vars env))) (local-def (cdr (assoc form venv)))) - (if (and (consp local-def) - (eq (car local-def) 'macro)) - (values (cdr local-def) t) - (values form nil)))) + (cond ((and (consp local-def) + (eq (car local-def) 'macro)) + (values (cdr local-def) t)) + ((eq (info :variable :kind form) :macro) + (values (info :variable :macro-expansion form) t)) + (t + (values form nil))))) (t (values form nil))))