;;; 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>
;; 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.
;; 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)
(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
(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
: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.")
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.")
(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))
;; 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))
(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.
'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."))
(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))))))
;; 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