Skip to content

Commit

Permalink
basic/simple implementation of find-definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Geo Carncross committed Apr 24, 2008
1 parent 2c2baba commit 98a99bd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions swank-ecl.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

(in-package :swank-backend)

(defvar *tmp*)

(if (find-package :gray)
(import-from :gray *gray-stream-symbols* :swank-backend)
(import-from :ext *gray-stream-symbols* :swank-backend))
Expand Down Expand Up @@ -300,16 +302,20 @@

;;;; Definitions

(defimplementation find-definitions (name) nil)
(defimplementation find-definitions (name)
(if (fboundp name)
(let ((tmp (find-source-location (symbol-function name))))
`(((defun ,name) ,tmp)))))

(defimplementation find-source-location (obj)
(setf *tmp* obj)
(or
(typecase obj
(function
(multiple-value-bind (file pos) (ignore-errors (si:bc-file obj))
(if (and file pos)
(make-location
`(:file ,file)
`(:file ,(namestring file))
`(:position ,pos)
`(:snippet
,(with-open-file (s file)
Expand Down

0 comments on commit 98a99bd

Please sign in to comment.