Function: semantic-analyze-find-tag-sequence-default

semantic-analyze-find-tag-sequence-default is a byte-compiled function defined in analyze.el.gz.

Signature

(semantic-analyze-find-tag-sequence-default SEQUENCE &optional SCOPE TYPERETURN THROWSYM FLAGS)

Documentation

Attempt to find all tags in SEQUENCE.

SCOPE are extra tags which are in scope. TYPERETURN is a symbol in which to place a list of tag classes that are found in SEQUENCE. Optional argument THROWSYM specifies a symbol the throw on non-recoverable error. Remaining arguments FLAGS are additional flags to apply when searching. This function knows of flags:
  mustbeclassvariable

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/analyze.el.gz
(defun semantic-analyze-find-tag-sequence-default
  ;; Note: overloadable fcn uses &rest, but it is a list already, so we don't need
  ;; to do that in the -default.
  (sequence &optional scope typereturn throwsym flags)
  "Attempt to find all tags in SEQUENCE.
SCOPE are extra tags which are in scope.
TYPERETURN is a symbol in which to place a list of tag classes that
are found in SEQUENCE.
Optional argument THROWSYM specifies a symbol the throw on non-recoverable
error.
Remaining arguments FLAGS are additional flags to apply when searching.
This function knows of flags:
  `mustbeclassvariable'"
  (let ((s sequence)			; copy of the sequence
	(tmp nil)			; tmp find variable
	(tag nil)			; tag return list
	(tagtype nil)			; tag types return list
	(fname nil)
	(miniscope (when scope (clone scope)))
	(tagclass (if (memq 'mustbeclassvariable flags)
		      'variable nil))
	)
    ;; First order check.  Is this wholly contained in the typecache?
    (setq tmp (semanticdb-typecache-find sequence))

    (when tmp
      (if (or (not tagclass) (semantic-tag-of-class-p tmp tagclass))
	  ;; We are effectively done...
	  (setq s nil
		tag (list tmp))
	;; tagclass doesn't match, so fail this.
	(setq tmp nil)))

    (unless tmp
      ;; For tag class filtering, only apply the filter if the first entry
      ;; is also the only entry.
      (let ((lftagclass (if (= (length s) 1) tagclass)))

	;; For the first entry, it better be a variable, but it might
	;; be in the local context too.
	;; NOTE: Don't forget c++ namespace foo::bar.
	(setq tmp (or
		   ;; Is this tag within our scope.  Scopes can sometimes
		   ;; shadow other things, so it goes first.
		   (and scope (semantic-scope-find (car s) lftagclass scope))
		   ;; Find the tag out there... somewhere, but not in scope
		   (semantic-analyze-find-tag (car s) lftagclass)
		   ))

	(if (and (listp tmp) (semantic-tag-p (car tmp)))
	    (setq tmp (semantic-analyze-select-best-tag tmp lftagclass)))
	(if (not (semantic-tag-p tmp))
	    (if throwsym
		(throw throwsym "Cannot find definition")
	      (error "Cannot find definition for \"%s\"" (car s))))
	(setq s (cdr s))
	(setq tag (cons tmp tag)) ; tag is nil here...
	(setq fname (semantic-tag-file-name tmp))
	))

    ;; For the middle entries
    (while s
      ;; Using the tag found in TMP, let's find the tag
      ;; representing the full typeographic information of its
      ;; type, and use that to determine the search context for
      ;; (car s)
      (let* ((tmptype
	      ;; In some cases the found TMP is a type,
	      ;; and we can use it directly.
	      (cond ((semantic-tag-of-class-p tmp 'type)
		     (or (semantic-analyze-type tmp miniscope)
			 tmp))
		    (t
		     (semantic-analyze-tag-type tmp miniscope))))
	     (typefile
	      (when tmptype
		(semantic-tag-file-name tmptype)))
	     (slots nil))

	;; Get the children
	(setq slots (semantic-analyze-scoped-type-parts tmptype scope))

	;; find (car s) in the list o slots
	(setq tmp (semantic-find-tags-by-name (car s) slots))

	;; If we have lots
	(if (and (listp tmp) (semantic-tag-p (car tmp)))
	    (setq tmp (semantic-analyze-select-best-tag tmp)))

	;; Make sure we have a tag.
	(if (not (semantic-tag-p tmp))
	    (if (cdr s)
		;; In the middle, we need to keep seeking our types out.
		(error "Cannot find definition for \"%s\"" (car s))
	      ;; Else, it's ok to end with a non-tag
	      (setq tmp (car s))))

	(setq fname (or typefile fname))
	(when (and fname (semantic-tag-p tmp)
		   (not (semantic-tag-in-buffer-p tmp)))
	  (semantic--tag-put-property tmp :filename fname))
	(setq tag (cons tmp tag))
	(setq tagtype (cons tmptype tagtype))
	(when miniscope
	  (let ((rawscope
		 (apply #'append
			(mapcar #'semantic-tag-type-members tagtype))))
	    (oset miniscope fullscope rawscope)))
	)
      (setq s (cdr s)))

    (if typereturn (set typereturn (nreverse tagtype)))
    ;; Return the mess
    (nreverse tag)))