X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcode%2Fmacroexpand.lisp;h=fc570d1cb02f73c905038f951033a91df1736441;hb=6c4d4d984b1af6b2a73568cec3ab9c8795cff2da;hp=b9274bf06b49ade2cf447bdeb4c132b8de9fa632;hpb=a530bbe337109d898d5b4a001fc8f1afa3b5dc39;p=sbcl.git diff --git a/src/code/macroexpand.lisp b/src/code/macroexpand.lisp index b9274bf..fc570d1 100644 --- a/src/code/macroexpand.lisp +++ b/src/code/macroexpand.lisp @@ -10,9 +10,6 @@ ;;;; files for more information. (in-package "SB!IMPL") - -(file-comment - "$Header$") ;;;; syntactic environment access @@ -36,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))) @@ -53,16 +50,19 @@ ;; in what it sends and liberal in what it ;; accepts" by doing the defaulting itself. ;; -- WHN 19991128 - (or env (make-null-lexenv))) + (coerce-to-lexenv env)) 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))))