X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fmacroexpand.lisp;h=fc570d1cb02f73c905038f951033a91df1736441;hb=c716f6ea5255afeb33a1181535b5c067aa9d6aaa;hp=8f467e5213b45eb1e579039a69f12c3f28fe9a46;hpb=416152f084604094445a758ff399871132dff2bd;p=sbcl.git diff --git a/src/code/macroexpand.lisp b/src/code/macroexpand.lisp index 8f467e5..fc570d1 100644 --- a/src/code/macroexpand.lisp +++ b/src/code/macroexpand.lisp @@ -33,7 +33,7 @@ #!+sb-doc "If form is a macro (or symbol macro), expands it once. Returns 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))) @@ -54,12 +54,15 @@ t) (values form nil)))) ((symbolp form) - (let* ((venv (when env (sb!c::lexenv-variables env))) + (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))))