Skip to content
Browse files

Initial support for find-source-location with functions

  • Loading branch information...
1 parent 324ab80 commit 2791323a6cc4f1c9f8f8cb4ce2dfa43ded5eba5a Geo Carncross committed Apr 24, 2008
Showing with 16 additions and 0 deletions.
  1. +16 −0 swank-ecl.lisp
View
16 swank-ecl.lisp
@@ -302,6 +302,22 @@
(defimplementation find-definitions (name) nil)
+(defimplementation find-source-location (obj)
+ (or
+ (typecase obj
+ (function
+ (multiple-value-bind (file pos) (ignore-errors (si:bc-file obj))
+ (if (and file pos)
+ `(:location
+ (:file ,file)
+ (:position ,pos)
+ (:snippet
+ ,(with-open-file (s file)
+ (skip-toplevel-forms pos s)
+ (skip-comments-and-whitespace s)
+ (read-snippet s))))))))
+ `(:error (format nil "Source definition of ~S not found" obj))))
+
;;;; Threads
#+threads

0 comments on commit 2791323

Please sign in to comment.
Something went wrong with that request. Please try again.