[slime-devel] Patch: Source location of methods (Allegro)
Willem Broekema
metawilm at gmail.com
Tue Jun 10 19:36:52 UTC 2008
The below patch works around the issue that Allegro does not record
the source file location for methods defined inside a defgeneric form.
The idea is that if the source location of a method is not found, then
the defgeneric form is almost certainly the right place.
For example:
(defgeneric foo (x)
(:method ((x fixnum)) (/ 1 0)))
Calling (foo 123) and hitting "v" in the traceback would result in
"Unknown source location for (method common-lisp-user::foo)" but with
the patch leads correctly to the defgeneric form.
(For methods defined outside the defgeneric form, the source location
recording works fine.)
*** swank-allegro.lisp 10 Jun 2008 19:55:30 +0200 1.102
--- swank-allegro.lisp 10 Jun 2008 21:19:20 +0200
***************
*** 414,419 ****
--- 414,426 ----
(fspec-definition-locations next)))
(t
(let ((defs (excl::find-source-file fspec)))
+ (when (and (null defs)
+ (listp fspec)
+ (string= (car fspec) '#:method))
+ ;; If methods are defined in a defgeneric form, the source location is
+ ;; recorded for the gf but not for the methods. Therefore fall back to
+ ;; the gf as the likely place of definition.
+ (setq defs (excl::find-source-file (second fspec))))
(if (null defs)
(list
(list (list nil fspec)
More information about the slime-devel
mailing list