1.0.30.15: more complete SB-CLTL2:DECLARATION-INFORMATION
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 29 Jul 2009 16:15:42 +0000 (16:15 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 29 Jul 2009 16:15:42 +0000 (16:15 +0000)
 * (DECLARATION-INFORMATION 'DECLARATION) returns a list of
   declaration names that have been proclaimed as valid.

   Patch by Larry D'Anna.

NEWS
contrib/sb-cltl2/env.lisp
contrib/sb-cltl2/tests.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 9fdeecc..7852683 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,8 +19,11 @@ changes relative to sbcl-1.0.30:
     but assumed or declared function as well.
   * improvement: recompilation of systems using SB-GROVEL now works
     (thanks to Leslie Polzer)
-  * improvement: SB-CLTL2 functions DECLARATION-INFORMATION, PARSE-MACRO,
-    and ENCLOSE have been documented (thanks to Larry D'Anna)
+  * improvements to SB-CLTL2 (thanks to Larry D'Anna):
+    ** functions DECLARATION-INFORMATION, PARSE-MACRO, and ENCLOSE have been
+       documented.
+    ** DECLARATION-INFORMATION now supports declaration name DECLARATION as
+       well.
   * bug fix: the low-level debugger had 32-bit assumptions and was missing
     information about some array types. (thanks to Luis Oliveira)
   * bug fix: moderately complex combinations of inline expansions could
index 8c35440..3ab4eb7 100644 (file)
@@ -8,7 +8,6 @@
 (in-package :sb-cltl2)
 
 #| TODO:
-declaration-information
 augment-environment
 define-declaration
 (map-environment)
@@ -225,8 +224,11 @@ appear with CDR as T if the variable has been declared always bound."
 (defun declaration-information (declaration-name &optional env)
   "Return information about declarations named by DECLARATION-NAME.
 
-If DECLARATION-NAME is optimize return a list who's entries are of the
-form (quality value).
+If DECLARATION-NAME is OPTIMIZE return a list who's entries are of the
+form \(QUALITY VALUE).
+
+If DECLARATION-NAME is DECLARATION return a list of declaration names that
+have been proclaimed as valid.
 
 If DECLARATION-NAME is SB-EXT:MUFFLE-CONDITIONS return a type specifier for
 the condition types that have been muffled."
@@ -243,6 +245,16 @@ the condition types that have been muffled."
       (sb-ext:muffle-conditions
        (car (rassoc 'muffle-warning
                     (sb-c::lexenv-handled-conditions env))))
+      (declaration
+       ;; FIXME: This is a bit too deep in the guts of INFO for comfort...
+       (let ((type (sb-c::type-info-number
+                    (sb-c::type-info-or-lose :declaration :recognized)))
+             (ret nil))
+         (dolist (env *info-environment*)
+           (do-info (env :name name :type-number num :value value)
+             (when (and (= num type) value)
+               (push name ret))))
+         ret))
       (t (error "Unsupported declaration ~S." declaration-name)))))
 
 (defun parse-macro (name lambda-list body &optional env)
index a314d8d..01b6974 100644 (file)
                (subtypep '(and warning (not style-warning)) dinfo)))))))
   t)
 
+
+(declaim (declaration fubar))
+
+(deftest declaration-information.declaration
+    (if (member 'fubar (declaration-information 'declaration)) 'yay)
+  yay)
+
 ;;;; VARIABLE-INFORMATION
 
 (defvar *foo*)
index fe94287..9d41cd9 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.30.14"
+"1.0.30.15"