From 37bf7dd7201a3b8c8db4b07b32934f6c5d3b6fdd Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Tue, 15 Oct 2013 18:29:02 +0400 Subject: [PATCH] sb-introspect:find-definition-sources-by-name: support globals. (sb-ext:defglobal x ...) couldn't be found. --- contrib/sb-introspect/introspect.lisp | 3 ++- contrib/sb-introspect/sb-introspect.asd | 4 ++-- contrib/sb-introspect/test-driver.lisp | 4 ++++ contrib/sb-introspect/test.lisp | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/contrib/sb-introspect/introspect.lisp b/contrib/sb-introspect/introspect.lisp index f4041fd..79706bb 100644 --- a/contrib/sb-introspect/introspect.lisp +++ b/contrib/sb-introspect/introspect.lisp @@ -195,7 +195,8 @@ If an unsupported TYPE is requested, the function will return NIL. (case type ((:variable) (when (and (symbolp name) - (eq (sb-int:info :variable :kind name) :special)) + (member (sb-int:info :variable :kind name) + '(:global :special))) (translate-source-location (sb-int:info :source-location type name)))) ((:constant) (when (and (symbolp name) diff --git a/contrib/sb-introspect/sb-introspect.asd b/contrib/sb-introspect/sb-introspect.asd index d547cc6..62734d0 100644 --- a/contrib/sb-introspect/sb-introspect.asd +++ b/contrib/sb-introspect/sb-introspect.asd @@ -63,8 +63,8 @@ (make-pathname :directory (pathname-directory '#.(or *compile-file-pathname* *load-pathname*))))) - (multiple-value-bind (soft strict pending) - (funcall (intern "DO-TESTS" (find-package "SB-RT"))) + (multiple-value-bind (soft strict #+sb-testing-contrib pending) + (funcall (find-symbol "DO-TESTS" "SB-RT")) (fresh-line) (unless strict #+sb-testing-contrib diff --git a/contrib/sb-introspect/test-driver.lisp b/contrib/sb-introspect/test-driver.lisp index aa7bfc8..fe920f0 100644 --- a/contrib/sb-introspect/test-driver.lisp +++ b/contrib/sb-introspect/test-driver.lisp @@ -202,6 +202,10 @@ (matchp-name :function 'cl-user::loaded-as-source-fun 3) t) +(deftest find-source-stuff. + (matchp-name :variable 'cl-user::**global** 29) + t) + ;;; Check wrt. interplay of generic functions and their methods. (defgeneric xuuq (gf.a gf.b &rest gf.rest &key gf.k-X)) diff --git a/contrib/sb-introspect/test.lisp b/contrib/sb-introspect/test.lisp index cd100c5..682074a 100644 --- a/contrib/sb-introspect/test.lisp +++ b/contrib/sb-introspect/test.lisp @@ -74,3 +74,5 @@ (eval-when (:compile-toplevel) (defun compile-time-too-fun () :foo)) + +(sb-ext:defglobal **global** 'value) -- 1.7.10.4