1 ;;; semantic/analyze.el --- Analyze semantic tags against local context
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
4 ;; Free Software Foundation, Inc.
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;; Semantic, as a tool, provides a nice list of searchable tags.
26 ;; That information can provide some very accurate answers if the current
27 ;; context of a position is known.
29 ;; Semantic-ctxt provides ways of analyzing, and manipulating the
30 ;; semantic context of a language in code.
32 ;; This library provides routines for finding intelligent answers to
33 ;; tough problems, such as if an argument to a function has the correct
34 ;; return type, or all possible tags that fit in a given local context.
39 ;; Here are some words used to describe different things in the analyzer:
41 ;; tag - A single entity
42 ;; prefix - The beginning of a symbol, usually used to look up something
44 ;; type - The name of a datatype in the language.
45 ;; metatype - If a type is named in a declaration like:
46 ;; struct moose somevariable;
47 ;; that name "moose" can be turned into a concrete type.
48 ;; tag sequence - In C code, a list of dereferences, such as:
49 ;; this.that.theother();
50 ;; parent - For a datatype in an OO language, another datatype
51 ;; inherited from. This excludes interfaces.
52 ;; scope - A list of tags that can be dereferenced that cannot
53 ;; be found from the global namespace.
54 ;; scopetypes - A list of tags which are datatype that contain
55 ;; the scope. The scopetypes need to have the scope extracted
56 ;; in a way that honors the type of inheritance.
57 ;; nest/nested - When one tag is contained entirely in another.
59 ;; context - A semantic datatype representing a point in a buffer.
61 ;; constriant - If a context specifies a specific datatype is needed,
62 ;; that is a constraint.
63 ;; constants - Some datatypes define elements of themselves as a
64 ;; constant. These need to be returned as there would be no
65 ;; other possible completions.
67 (eval-when-compile (require 'cl
))
69 (require 'semantic
/format
)
70 (require 'semantic
/ctxt
)
71 (require 'semantic
/scope
)
72 (require 'semantic
/sort
)
73 (require 'semantic
/analyze
/fcn
)
75 (eval-when-compile (require 'semantic
/find
))
77 (declare-function data-debug-new-buffer
"data-debug")
78 (declare-function data-debug-insert-object-slots
"eieio-datadebug")
81 (defvar semantic-analyze-error-stack nil
82 "Collection of any errors thrown during analysis.")
84 (defun semantic-analyze-push-error (err)
85 "Push the error in ERR-DATA onto the error stack.
87 (push err semantic-analyze-error-stack
))
91 ;; These classes represent what a context is. Different types
92 ;; of contexts provide differing amounts of information to help
93 ;; provide completions.
95 (defclass semantic-analyze-context
()
96 ((bounds :initarg
:bounds
98 :documentation
"The bounds of this context.
99 Usually bound to the dimension of a single symbol or command.")
100 (prefix :initarg
:prefix
102 :documentation
"List of tags defining local text.
103 This can be nil, or a list where the last element can be a string
104 representing text that may be incomplete. Preceding elements
105 must be semantic tags representing variables or functions
106 called in a dereference sequence.")
107 (prefixclass :initarg
:prefixclass
109 :documentation
"Tag classes expected at this context.
110 These are clases for tags, such as 'function, or 'variable.")
111 (prefixtypes :initarg
:prefixtypes
113 :documentation
"List of tags defining types for :prefix.
114 This list is one shorter than :prefix. Each element is a semantic
115 tag representing a type matching the semantic tag in the same
116 position in PREFIX.")
117 (scope :initarg
:scope
118 :type
(or null semantic-scope-cache
)
119 :documentation
"List of tags available in scopetype.
120 See `semantic-analyze-scoped-tags' for details.")
121 (buffer :initarg
:buffer
123 :documentation
"The buffer this context is derived from.")
124 (errors :initarg
:errors
125 :documentation
"Any errors thrown an caught during analysis.")
127 "Base analysis data for any context.")
129 (defclass semantic-analyze-context-assignment
(semantic-analyze-context)
130 ((assignee :initarg
:assignee
132 :documentation
"A sequence of tags for an assignee.
133 This is a variable into which some value is being placed. The last
134 item in the list is the variable accepting the value. Earlier
135 tags represent the variables being dereferenced to get to the
137 "Analysis class for a value in an assignment.")
139 (defclass semantic-analyze-context-functionarg
(semantic-analyze-context)
140 ((function :initarg
:function
142 :documentation
"A sequence of tags for a function.
143 This is a function being called. The cursor will be in the position
145 The last tag in :function is the function being called. Earlier
146 tags represent the variables being dereferenced to get to the
148 (index :initarg
:index
150 :documentation
"The index of the argument for this context.
151 If a function takes 4 arguments, this value should be bound to
152 the values 1 through 4.")
153 (argument :initarg
:argument
155 :documentation
"A sequence of tags for the :index argument.
156 The argument can accept a value of some type, and this contains the
157 tag for that definition. It should be a tag, but might
158 be just a string in some circumstances.")
160 "Analysis class for a value as a function argument.")
162 (defclass semantic-analyze-context-return
(semantic-analyze-context)
164 "Analysis class for return data.
165 Return data methods identify the requred type by the return value
166 of the parent function.")
170 ;; Simple methods against the context classes.
172 (defmethod semantic-analyze-type-constraint
173 ((context semantic-analyze-context
) &optional desired-type
)
174 "Return a type constraint for completing :prefix in CONTEXT.
175 Optional argument DESIRED-TYPE may be a non-type tag to analyze."
176 (when (semantic-tag-p desired-type
)
177 ;; Convert the desired type if needed.
178 (if (not (eq (semantic-tag-class desired-type
) 'type
))
179 (setq desired-type
(semantic-tag-type desired-type
)))
180 ;; Protect against plain strings
181 (cond ((stringp desired-type
)
182 (setq desired-type
(list desired-type
'type
)))
183 ((and (stringp (car desired-type
))
184 (not (semantic-tag-p desired-type
)))
185 (setq desired-type
(list (car desired-type
) 'type
)))
186 ((semantic-tag-p desired-type
)
187 ;; We have a tag of some sort. Yay!
189 (t (setq desired-type nil
))
193 (defmethod semantic-analyze-type-constraint
194 ((context semantic-analyze-context-functionarg
))
195 "Return a type constraint for completing :prefix in CONTEXT."
196 (call-next-method context
(car (oref context argument
))))
198 (defmethod semantic-analyze-type-constraint
199 ((context semantic-analyze-context-assignment
))
200 "Return a type constraint for completing :prefix in CONTEXT."
201 (call-next-method context
(car (reverse (oref context assignee
)))))
203 (defmethod semantic-analyze-interesting-tag
204 ((context semantic-analyze-context
))
205 "Return a tag from CONTEXT that would be most interesting to a user."
206 (let ((prefix (reverse (oref context
:prefix
))))
207 ;; Go back through the prefix until we find a tag we can return.
208 (while (and prefix
(not (semantic-tag-p (car prefix
))))
209 (setq prefix
(cdr prefix
)))
210 ;; Return the found tag, or nil.
213 (defmethod semantic-analyze-interesting-tag
214 ((context semantic-analyze-context-functionarg
))
215 "Try the base, and if that fails, return what we are assigning into."
216 (or (call-next-method) (car-safe (oref context
:function
))))
218 (defmethod semantic-analyze-interesting-tag
219 ((context semantic-analyze-context-assignment
))
220 "Try the base, and if that fails, return what we are assigning into."
221 (or (call-next-method) (car-safe (oref context
:assignee
))))
225 ;; Start out with routines that will calculate useful parts of
226 ;; the general analyzer function. These could be used directly
227 ;; by an application that doesn't need to calculate the full
230 (define-overloadable-function semantic-analyze-find-tag-sequence
(sequence &optional
231 scope typereturn throwsym
)
232 "Attempt to find all tags in SEQUENCE.
233 Optional argument LOCALVAR is the list of local variables to use when
234 finding the details on the first element of SEQUENCE in case
235 it is not found in the global set of tables.
236 Optional argument SCOPE are additional terminals to search which are currently
237 scoped. These are not local variables, but symbols available in a structure
238 which doesn't need to be dereferenced.
239 Optional argument TYPERETURN is a symbol in which the types of all found
240 will be stored. If nil, that data is thrown away.
241 Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.")
243 (defun semantic-analyze-find-tag-sequence-default (sequence &optional
246 "Attempt to find all tags in SEQUENCE.
247 SCOPE are extra tags which are in scope.
248 TYPERETURN is a symbol in which to place a list of tag classes that
249 are found in SEQUENCE.
250 Optional argument THROWSYM specifies a symbol the throw on non-recoverable error."
251 (let ((s sequence
) ; copy of the sequence
252 (tmp nil
) ; tmp find variable
253 (tag nil
) ; tag return list
254 (tagtype nil
) ; tag types return list
256 (miniscope (when scope
(clone scope
)))
258 ;; First order check. Is this wholely contained in the typecache?
259 (setq tmp
(semanticdb-typecache-find sequence
))
263 ;; We are effectively done...
265 (setq tag
(list tmp
)))
267 ;; For the first entry, it better be a variable, but it might
268 ;; be in the local context too.
269 ;; NOTE: Don't forget c++ namespace foo::bar.
271 ;; Is this tag within our scope. Scopes can sometimes
272 ;; shadow other things, so it goes first.
273 (and scope
(semantic-scope-find (car s
) nil scope
))
274 ;; Find the tag out there... somewhere, but not in scope
275 (semantic-analyze-find-tag (car s
))
278 (if (and (listp tmp
) (semantic-tag-p (car tmp
)))
279 (setq tmp
(semantic-analyze-select-best-tag tmp
)))
280 (if (not (semantic-tag-p tmp
))
282 (throw throwsym
"Cannot find definition")
283 (error "Cannot find definition for \"%s\"" (car s
))))
285 (setq tag
(cons tmp tag
)) ; tag is nil here...
286 (setq fname
(semantic-tag-file-name tmp
))
289 ;; For the middle entries
291 ;; Using the tag found in TMP, lets find the tag
292 ;; representing the full typeographic information of its
293 ;; type, and use that to determine the search context for
296 ;; In some cases the found TMP is a type,
297 ;; and we can use it directly.
298 (cond ((semantic-tag-of-class-p tmp
'type
)
299 ;; update the miniscope when we need to analyze types directly.
303 (mapcar 'semantic-tag-type-members
305 (oset miniscope fullscope rawscope
)))
306 ;; Now analayze the type to remove metatypes.
307 (or (semantic-analyze-type tmp miniscope
)
310 (semantic-analyze-tag-type tmp scope
))))
313 (semantic-tag-file-name tmptype
)))
317 (setq slots
(semantic-analyze-scoped-type-parts tmptype scope
))
319 ;; find (car s) in the list o slots
320 (setq tmp
(semantic-find-tags-by-name (car s
) slots
))
323 (if (and (listp tmp
) (semantic-tag-p (car tmp
)))
324 (setq tmp
(semantic-analyze-select-best-tag tmp
)))
326 ;; Make sure we have a tag.
327 (if (not (semantic-tag-p tmp
))
329 ;; In the middle, we need to keep seeking our types out.
330 (error "Cannot find definition for \"%s\"" (car s
))
331 ;; Else, it's ok to end with a non-tag
334 (setq fname
(or typefile fname
))
335 (when (and fname
(semantic-tag-p tmp
)
336 (not (semantic-tag-in-buffer-p tmp
)))
337 (semantic--tag-put-property tmp
:filename fname
))
338 (setq tag
(cons tmp tag
))
339 (setq tagtype
(cons tmptype tagtype
))
343 (if typereturn
(set typereturn
(nreverse tagtype
)))
347 (defun semantic-analyze-find-tag (name &optional tagclass scope
)
348 "Return the first tag found with NAME or nil if not found.
349 Optional argument TAGCLASS specifies the class of tag to return,
350 such as 'function or 'variable.
351 Optional argument SCOPE specifies a scope object which has
352 additional tags which are in SCOPE and do not need prefixing to
355 This is a wrapper on top of semanticdb, semanticdb typecache,
356 semantic-scope, and semantic search functions. Almost all
357 searches use the same arguments."
358 (let ((namelst (if (consp name
) name
;; test if pre-split.
359 (semantic-analyze-split-name name
))))
361 ;; If the splitter gives us a list, use the sequence finder
362 ;; to get the list. Since this routine is expected to return
363 ;; only one tag, return the LAST tag found from the sequence
364 ;; which is supposedly the nested reference.
366 ;; Of note, the SEQUENCE function below calls this function
367 ;; (recursively now) so the names that we get from the above
368 ;; fcn better not, in turn, be splittable.
370 ;; If we had a split, then this is likely a c++ style namespace::name sequence,
371 ;; so take a short-cut through the typecache.
372 (or (semanticdb-typecache-find namelst
)
373 ;; Ok, not there, try the usual...
374 (let ((seq (semantic-analyze-find-tag-sequence
376 (semantic-analyze-select-best-tag seq tagclass
)
378 ;; If NAME is solo, then do our searches for it here.
380 (let ((retlist (and scope
(semantic-scope-find name tagclass scope
))))
382 (semantic-analyze-select-best-tag
384 (if (eq tagclass
'type
)
385 (semanticdb-typecache-find name
)
386 ;; Search in the typecache. First entries in a sequence are
388 (setq retlist
(semanticdb-typecache-find name
))
391 (semantic-analyze-select-best-tag
392 (semanticdb-strip-find-results
393 (semanticdb-find-tags-by-name name
)
401 ;; Create a mini-analysis of just the symbol under point.
403 (define-overloadable-function semantic-analyze-current-symbol
404 (analyzehookfcn &optional position
)
405 "Call ANALYZEHOOKFCN after analyzing the symbol under POSITION.
406 The ANALYZEHOOKFCN is called with the current symbol bounds, and the
407 analyzed prefix. It should take the arguments (START END PREFIX).
408 The ANALYZEHOOKFCN is only called if some sort of prefix with bounds was
409 found under POSITION.
411 The results of ANALYZEHOOKFCN is returned, or nil if there was nothing to
414 For regular analysis, you should call `semantic-analyze-current-context'
415 to calculate the context information. The purpose for this function is
416 to provide a large number of non-cached analysis for filtering symbols."
417 ;; Only do this in a Semantic enabled buffer.
418 (when (not (semantic-active-p))
419 (error "Cannot analyze buffers not supported by Semantic"))
420 ;; Always refresh out tags in a safe way before doing the
422 (semantic-refresh-tags-safe)
423 ;; Do the rest of the analysis.
429 (defun semantic-analyze-current-symbol-default (analyzehookfcn position
)
430 "Call ANALYZEHOOKFCN on the analyzed symbol at POSITION."
431 (let* ((semantic-analyze-error-stack nil
)
432 (LLstart (current-time))
433 (prefixandbounds (semantic-ctxt-current-symbol-and-bounds (or position
(point))))
434 (prefix (car prefixandbounds
))
435 (bounds (nth 2 prefixandbounds
))
436 (scope (semantic-calculate-scope position
))
439 ;; Only do work if we have bounds (meaning a prefix to complete)
444 ;; If debug on error is on, allow debugging in this fcn.
445 (setq prefix
(semantic-analyze-find-tag-sequence
446 prefix scope
'prefixtypes
'unfindable
)))
447 ;; Debug on error is off. Capture errors and move on
449 ;; NOTE: This line is duplicated in
450 ;; semantic-analyzer-debug-global-symbol
451 ;; You will need to update both places.
452 (setq prefix
(semantic-analyze-find-tag-sequence
453 prefix scope
'prefixtypes
))
454 (error (semantic-analyze-push-error err
))))
456 (setq end
(current-time))
457 ;;(message "Analysis took %.2f sec" (semantic-elapsed-time LLstart end))
462 (funcall analyzehookfcn
(car bounds
) (cdr bounds
) prefix
)
463 ;;(setq end (current-time))
464 ;;(message "hookfcn took %.5f sec" (semantic-elapsed-time LLstart end))
471 ;; Create a full-up context analysis.
474 (define-overloadable-function semantic-analyze-current-context
(&optional position
)
475 "Analyze the current context at optional POSITION.
476 If called interactively, display interesting information about POSITION
477 in a separate buffer.
478 Returns an object based on symbol `semantic-analyze-context'.
480 This function can be overriden with the symbol `analyze-context'.
481 When overriding this function, your override will be called while
482 cursor is at POSITION. In addition, your function will not be called
483 if a cached copy of the return object is found."
485 ;; Only do this in a Semantic enabled buffer.
486 (when (not (semantic-active-p))
487 (error "Cannot analyze buffers not supported by Semantic"))
488 ;; Always refresh out tags in a safe way before doing the
490 (semantic-refresh-tags-safe)
491 ;; Do the rest of the analysis.
492 (if (not position
) (setq position
(point)))
495 (let* ((answer (semantic-get-cache-data 'current-context
)))
496 (with-syntax-table semantic-lex-syntax-table
498 (setq answer
(:override
))
499 (when (and answer
(oref answer bounds
))
500 (with-slots (bounds) answer
501 (semantic-cache-data-to-buffer (current-buffer)
507 ;; Check for interactivity
508 (when (called-interactively-p 'any
)
510 (semantic-analyze-pop-to-context answer
)
511 (message "No Context."))
516 (defun semantic-analyze-current-context-default (position)
517 "Analyze the current context at POSITION.
518 Returns an object based on symbol `semantic-analyze-context'."
519 (let* ((semantic-analyze-error-stack nil
)
521 (prefixandbounds (semantic-ctxt-current-symbol-and-bounds (or position
(point))))
522 (prefix (car prefixandbounds
))
523 (bounds (nth 2 prefixandbounds
))
524 ;; @todo - vv too early to really know this answer! vv
525 (prefixclass (semantic-ctxt-current-class-list))
527 (scope (semantic-calculate-scope position
))
534 ;; Pattern for Analysis:
536 ;; Step 1: Calculate DataTypes in Scope:
538 ;; a) Calculate the scope (above)
540 ;; Step 2: Parse context
542 ;; a) Identify function being called, or variable assignment,
543 ;; and find source tags for those references
544 ;; b) Identify the prefix (text cursor is on) and find the source
545 ;; tags for those references.
547 ;; Step 3: Assemble an object
552 (setq function
(semantic-ctxt-current-function))
555 ;; Calculate the argument for the function if there is one.
556 (setq arg
(semantic-ctxt-current-argument))
558 ;; Find a tag related to the function name.
561 (semantic-analyze-find-tag-sequence function scope
))
562 (error (semantic-analyze-push-error err
)))
564 ;; fntag can have the last entry as just a string, meaning we
565 ;; could not find the core datatype. In this case, the searches
566 ;; below will not work.
567 (when (stringp (car (last fntag
)))
568 ;; Take a wild guess!
569 (setcar (last fntag
) (semantic-tag (car (last fntag
)) 'function
))
573 (let ((fcn (semantic-find-tags-by-class 'function fntag
)))
575 (let ((ty (semantic-find-tags-by-class 'type fntag
)))
577 ;; We might have a constructor with the same name as
578 ;; the found datatype.
579 (setq fcn
(semantic-find-tags-by-name
580 (semantic-tag-name (car ty
))
581 (semantic-tag-type-members (car ty
))))
585 (when (semantic-tag-get-attribute (car lp
)
587 (setq fcn
(cons (car lp
) fcn
)))
589 ;; Give up, go old school
592 (setq fntagend
(car (reverse fcn
))
594 (when (semantic-tag-p fntagend
)
595 (nth (1- arg
) (semantic-tag-function-arguments fntagend
)))
600 ;; Only do work if we have bounds (meaning a prefix to complete)
605 ;; If debug on error is on, allow debugging in this fcn.
606 (setq prefix
(semantic-analyze-find-tag-sequence
607 prefix scope
'prefixtypes
'unfindable
)))
608 ;; Debug on error is off. Capture errors and move on
610 ;; NOTE: This line is duplicated in
611 ;; semantic-analyzer-debug-global-symbol
612 ;; You will need to update both places.
613 (setq prefix
(semantic-analyze-find-tag-sequence
614 prefix scope
'prefixtypes
))
615 (error (semantic-analyze-push-error err
))))
622 ;; If we found a tag for our function, we can go into
623 ;; functional context analysis mode, meaning we have a type
626 (semantic-analyze-context-functionarg
628 :buffer
(current-buffer)
631 :argument
(list argtag
)
634 :prefixclass prefixclass
636 :prefixtypes prefixtypes
637 :errors semantic-analyze-error-stack
)))
639 ;; No function, try assignment
640 ((and (setq assign
(semantic-ctxt-current-assignment))
641 ;; We have some sort of an assignment
643 (setq asstag
(semantic-analyze-find-tag-sequence
645 (error (semantic-analyze-push-error err
)
649 (semantic-analyze-context-assignment
651 :buffer
(current-buffer)
656 :prefixclass prefixclass
657 :prefixtypes prefixtypes
658 :errors semantic-analyze-error-stack
)))
660 ;; TODO: Identify return value condition.
661 ;;((setq return .... what to do?)
665 ;; Nothing in particular
667 (semantic-analyze-context
669 :buffer
(current-buffer)
673 :prefixclass prefixclass
674 :prefixtypes prefixtypes
675 :errors semantic-analyze-error-stack
)))
677 (t (setq context-return nil
))
680 ;; Return our context.
684 (defun semantic-adebug-analyze (&optional ctxt
)
685 "Perform `semantic-analyze-current-context'.
686 Display the results as a debug list.
687 Optional argument CTXT is the context to show."
689 (require 'data-debug
)
690 (let ((start (current-time))
691 (ctxt (or ctxt
(semantic-analyze-current-context)))
692 (end (current-time)))
694 (message "No Analyzer Results")
695 (message "Analysis took %.2f seconds."
696 (semantic-elapsed-time start end
))
697 (semantic-analyze-pulse ctxt
)
700 (data-debug-new-buffer "*Analyzer ADEBUG*")
701 (data-debug-insert-object-slots ctxt
"]"))
702 (message "No Context to analyze here.")))))
707 ;; Friendly output of a context analysis.
709 (declare-function pulse-momentary-highlight-region
"pulse")
711 (defmethod semantic-analyze-pulse ((context semantic-analyze-context
))
712 "Pulse the region that CONTEXT affects."
714 (with-current-buffer (oref context
:buffer
)
715 (let ((bounds (oref context
:bounds
)))
717 (pulse-momentary-highlight-region (car bounds
) (cdr bounds
))))))
719 (defcustom semantic-analyze-summary-function
'semantic-format-tag-prototype
720 "Function to use when creating items in Imenu.
721 Some useful functions are found in `semantic-format-tag-functions'."
723 :type semantic-format-tag-custom-list
)
725 (defun semantic-analyze-princ-sequence (sequence &optional prefix buff
)
726 "Send the tag SEQUENCE to standard out.
727 Use PREFIX as a label.
728 Use BUFF as a source of override methods."
732 ((semantic-tag-p (car sequence
))
733 (princ (funcall semantic-analyze-summary-function
735 ((stringp (car sequence
))
737 (princ (semantic--format-colorize-text (car sequence
) 'variable
))
740 (princ (format "'%S" (car sequence
)))))
742 (setq sequence
(cdr sequence
))
743 (setq prefix
(make-string (length prefix
) ?
))
746 (defmethod semantic-analyze-show ((context semantic-analyze-context
))
747 "Insert CONTEXT into the current buffer in a nice way."
748 (semantic-analyze-princ-sequence (oref context prefix
) "Prefix: " )
749 (semantic-analyze-princ-sequence (oref context prefixclass
) "Prefix Classes: ")
750 (semantic-analyze-princ-sequence (oref context prefixtypes
) "Prefix Types: ")
751 (semantic-analyze-princ-sequence (oref context errors
) "Encountered Errors: ")
753 ;(semantic-analyze-princ-sequence (oref context scopetypes) "Scope Types: ")
754 ;(semantic-analyze-princ-sequence (oref context scope) "Scope: ")
755 ;(semantic-analyze-princ-sequence (oref context localvariables) "LocalVars: ")
756 (when (oref context scope
)
757 (semantic-analyze-show (oref context scope
)))
760 (defmethod semantic-analyze-show ((context semantic-analyze-context-assignment
))
761 "Insert CONTEXT into the current buffer in a nice way."
762 (semantic-analyze-princ-sequence (oref context assignee
) "Assignee: ")
765 (defmethod semantic-analyze-show ((context semantic-analyze-context-functionarg
))
766 "Insert CONTEXT into the current buffer in a nice way."
767 (semantic-analyze-princ-sequence (oref context function
) "Function: ")
768 (princ "Argument Index: ")
769 (princ (oref context index
))
771 (semantic-analyze-princ-sequence (oref context argument
) "Argument: ")
774 (defun semantic-analyze-pop-to-context (context)
775 "Display CONTEXT in a temporary buffer.
776 CONTEXT's content is described in `semantic-analyze-current-context'."
777 (semantic-analyze-pulse context
)
778 (with-output-to-temp-buffer "*Semantic Context Analysis*"
779 (princ "Context Type: ")
780 (princ (object-name context
))
783 (princ (oref context bounds
))
785 (semantic-analyze-show context
)
787 (shrink-window-if-larger-than-buffer
788 (get-buffer-window "*Semantic Context Analysis*"))
791 (provide 'semantic
/analyze
)
794 ;; generated-autoload-file: "loaddefs.el"
795 ;; generated-autoload-load-name: "semantic/analyze"
798 ;; arch-tag: 1102143a-1c05-4631-83e8-45aafc6b4a59
799 ;;; semantic/analyze.el ends here