[cmucl-imp] Source location for symbol macros

Helmut Eller heller at common-lisp.net
Sun Dec 16 19:24:13 UTC 2012


On Sun, Dec 16 2012, Helmut Eller wrote:

> The patch below adds source location recording to define-symbol-macro.

Let's see if the patch passes this time:

diff --git a/src/code/macros.lisp b/src/code/macros.lisp
index 934bcbb..892e1cf 100644
--- a/src/code/macros.lisp
+++ b/src/code/macros.lisp
@@ -192,9 +192,9 @@
 ;;;
 (defmacro define-symbol-macro (name expansion)
   `(eval-when (:compile-toplevel :load-toplevel :execute)
-     (%define-symbol-macro ',name ',expansion)))
+     (%define-symbol-macro ',name ',expansion (c::source-location))))
 ;;;
-(defun %define-symbol-macro (name expansion)
+(defun %define-symbol-macro (name expansion source-location)
   (unless (symbolp name)
     (error 'simple-type-error :datum name :expected-type 'symbol
 	   :format-control (intl:gettext "Symbol macro name is not a symbol: ~S.")
@@ -202,7 +202,8 @@
   (ecase (info variable kind name)
     ((:macro :global nil)
      (setf (info variable kind name) :macro)
-     (setf (info variable macro-expansion name) expansion))
+     (setf (info variable macro-expansion name) expansion)
+     (set-defvar-source-location name source-location))
     (:special
      (error 'simple-program-error
 	    :format-control (intl:gettext "Symbol macro name already declared special: ~S.")



More information about the cmucl-imp mailing list