]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/analyze.el
Fix errors in CEDET 1.0 merge.
[gnu-emacs] / lisp / cedet / semantic / analyze.el
index 7acd237d514081dfd2973611b531a97f5880d39f..4009685683baeea4392e4d114a416bc35e724d86 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/analyze.el --- Analyze semantic tags against local context
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
@@ -41,7 +41,7 @@
 ;; tag - A single entity
 ;; prefix - The beginning of a symbol, usually used to look up something
 ;;       incomplete.
-;; type - The name of a datatype in the langauge.
+;; type - The name of a datatype in the language.
 ;; metatype - If a type is named in a declaration like:
 ;;       struct moose somevariable;
 ;;       that name "moose" can be turned into a concrete type.
@@ -64,6 +64,7 @@
 ;;       constant.  These need to be returned as there would be no
 ;;       other possible completions.
 
+(eval-when-compile (require 'cl))
 (require 'semantic)
 (require 'semantic/format)
 (require 'semantic/ctxt)
@@ -82,7 +83,7 @@
 
 (defun semantic-analyze-push-error (err)
   "Push the error in ERR-DATA onto the error stack.
-Argument ERR"
+Argument ERR."
   (push err semantic-analyze-error-stack))
 
 ;;; Analysis Classes
@@ -123,7 +124,7 @@ See `semantic-analyze-scoped-tags' for details.")
    (errors :initarg :errors
           :documentation "Any errors thrown an caught during analysis.")
    )
-  "Base analysis data for a any context.")
+  "Base analysis data for any context.")
 
 (defclass semantic-analyze-context-assignment (semantic-analyze-context)
   ((assignee :initarg :assignee
@@ -131,7 +132,7 @@ See `semantic-analyze-scoped-tags' for details.")
             :documentation "A sequence of tags for an assignee.
 This is a variable into which some value is being placed.  The last
 item in the list is the variable accepting the value.  Earlier
-tags represent the variables being derefernece to get to the
+tags represent the variables being dereferenced to get to the
 assignee."))
   "Analysis class for a value in an assignment.")
 
@@ -234,7 +235,7 @@ finding the details on the first element of SEQUENCE in case
 it is not found in the global set of tables.
 Optional argument SCOPE are additional terminals to search which are currently
 scoped.  These are not local variables, but symbols available in a structure
-which doesn't need to be dereferneced.
+which doesn't need to be dereferenced.
 Optional argument TYPERETURN is a symbol in which the types of all found
 will be stored.  If nil, that data is thrown away.
 Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.")
@@ -252,7 +253,7 @@ Optional argument THROWSYM specifies a symbol the throw on non-recoverable error
        (tag nil)                       ; tag return list
        (tagtype nil)                   ; tag types return list
        (fname nil)
-       (miniscope (clone scope))
+       (miniscope (when scope (clone scope)))
        )
     ;; First order check.  Is this wholely contained in the typecache?
     (setq tmp (semanticdb-typecache-find sequence))
@@ -296,11 +297,12 @@ Optional argument THROWSYM specifies a symbol the throw on non-recoverable error
              ;; and we can use it directly.
              (cond ((semantic-tag-of-class-p tmp 'type)
                     ;; update the miniscope when we need to analyze types directly.
-                    (let ((rawscope
-                           (apply 'append
-                                  (mapcar 'semantic-tag-type-members
-                                          tagtype))))
-                      (oset miniscope fullscope rawscope))
+                    (when miniscope
+                      (let ((rawscope
+                             (apply 'append
+                                    (mapcar 'semantic-tag-type-members
+                                            tagtype))))
+                        (oset miniscope fullscope rawscope)))
                     ;; Now analayze the type to remove metatypes.
                     (or (semantic-analyze-type tmp miniscope)
                         tmp))
@@ -344,13 +346,13 @@ Optional argument THROWSYM specifies a symbol the throw on non-recoverable error
 
 (defun semantic-analyze-find-tag (name &optional tagclass scope)
   "Return the first tag found with NAME or nil if not found.
-Optional argument TAGCLASS specifies the class of tag to return, such
-as 'function or 'variable.
+Optional argument TAGCLASS specifies the class of tag to return,
+such as 'function or 'variable.
 Optional argument SCOPE specifies a scope object which has
 additional tags which are in SCOPE and do not need prefixing to
 find.
 
-This is a wrapper on top of semanticdb, semanticdb-typecache,
+This is a wrapper on top of semanticdb, semanticdb typecache,
 semantic-scope, and semantic search functions.  Almost all
 searches use the same arguments."
   (let ((namelst (if (consp name) name ;; test if pre-split.
@@ -503,7 +505,7 @@ if a cached copy of the return object is found."
                                             'current-context
                                             'exit-cache-zone)))
          ;; Check for interactivity
-         (when (interactive-p)
+         (when (called-interactively-p 'any)
            (if answer
                (semantic-analyze-pop-to-context answer)
              (message "No Context."))
@@ -709,8 +711,7 @@ Optional argument CTXT is the context to show."
 (defmethod semantic-analyze-pulse ((context semantic-analyze-context))
   "Pulse the region that CONTEXT affects."
   (require 'pulse)
-  (save-excursion
-    (set-buffer (oref context :buffer))
+  (with-current-buffer (oref context :buffer)
     (let ((bounds (oref context :bounds)))
       (when bounds
        (pulse-momentary-highlight-region (car bounds) (cdr bounds))))))
@@ -791,8 +792,8 @@ CONTEXT's content is described in `semantic-analyze-current-context'."
 
 ;; Local variables:
 ;; generated-autoload-file: "loaddefs.el"
-;; generated-autoload-feature: semantic/loaddefs
 ;; generated-autoload-load-name: "semantic/analyze"
 ;; End:
 
+;; arch-tag: 1102143a-1c05-4631-83e8-45aafc6b4a59
 ;;; semantic/analyze.el ends here