Function: semantic-up-reference-default

semantic-up-reference-default is a byte-compiled function defined in senator.el.gz.

Signature

(semantic-up-reference-default TAG)

Documentation

Return a tag that is referred to by TAG.

Makes C/C++ language like assumptions.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/senator.el.gz
(defun semantic-up-reference-default (tag)
  "Return a tag that is referred to by TAG.
Makes C/C++ language like assumptions."
  (cond ((semantic-tag-faux-p tag)
         ;; Faux tags should have a real tag in some other location.
	 (require 'semantic/sort)
         (let ((options (semantic-tag-external-class tag)))
           ;; I should do something a little better than
           ;; this.  Oy!
           (car options)
           ))

	;; Include always point to another file.
        ((eq (semantic-tag-class tag) 'include)
	 (let ((file (semantic-dependency-tag-file tag)))
	   (cond
	    ((or (not file) (not (file-exists-p file)))
	     (error "Could not location include %s"
		    (semantic-tag-name tag)))
	    ((get-file-buffer file)
	     (get-file-buffer file))
	    ((stringp file)
	     file)
	    )))

	;; Is there a parent of the function to jump to?
        ((and (semantic-tag-of-class-p tag 'function)
              (semantic-tag-function-parent tag))
         (let* ((scope (semantic-calculate-scope (point))))
	   ;; @todo - it would be cool to ask the user which one if
	   ;; more than one.
	   (car (oref scope parents))
	   ))

	;; Is there a non-prototype version of the tag to jump to?
        ((semantic-tag-get-attribute tag :prototype-flag)
	 (require 'semantic/analyze/refs)
	 (let* ((sar (semantic-analyze-tag-references tag)))
	   (car (semantic-analyze-refs-impl sar t)))
	 )

	;; If this is a datatype, and we have superclasses
	((and (semantic-tag-of-class-p tag 'type)
	      (semantic-tag-type-superclasses tag))
	 (require 'semantic/analyze)
	 (let ((scope (semantic-calculate-scope (point)))
	       (parents (semantic-tag-type-superclasses tag)))
	   (semantic-analyze-find-tag (car parents) 'type scope)))

	;; Get the data type, and try to find that.
        ((semantic-tag-type tag)
	 (let ((scope (semantic-calculate-scope (point))))
	   (semantic-analyze-tag-type tag scope))
	 )
        (t nil)))