Function: semantic-get-local-variables-default

semantic-get-local-variables-default is a byte-compiled function defined in ctxt.el.gz.

Signature

(semantic-get-local-variables-default)

Documentation

Get local values from a specific context.

Uses the bovinator with the special top-symbol bovine-inner-scope to collect tags, such as local variables or prototypes.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/ctxt.el.gz
(defun semantic-get-local-variables-default ()
  "Get local values from a specific context.
Uses the bovinator with the special top-symbol `bovine-inner-scope'
to collect tags, such as local variables or prototypes."
  ;; This assumes a bovine parser.  Make sure we don't do
  ;; anything in that case.
  (when (and semantic--parse-table (not (eq semantic--parse-table t)))
    (let ((vars (semantic-get-cache-data 'get-local-variables)))
      (if vars
	  (progn
	    ;;(message "Found cached vars.")
	    vars)
	(let ((vars2 nil)
	      ;; We want nothing to do with funny syntaxing while doing this.
	      (semantic-unmatched-syntax-hook nil)
	      (start (point))
	      (firstusefulstart nil)
	      )
	  (while (not (semantic-up-context (point) 'function))
	    (when (not vars)
	      (setq firstusefulstart (point)))
	    (save-excursion
	      (forward-char 1)
	      (setq vars
		    ;; Note to self: semantic-parse-region returns cooked
		    ;; but unlinked tags.  File information is lost here
		    ;; and is added next.
		    (append (semantic-parse-region
			     (point)
			     (save-excursion (semantic-end-of-context) (point))
			     'bovine-inner-scope
			     nil
			     t)
			    vars))))
	  ;; Modify the tags in place.
	  (setq vars2 vars)
	  (while vars2
	    (semantic--tag-put-property (car vars2) :filename (buffer-file-name))
	    (setq vars2 (cdr vars2)))
	  ;; Hash our value into the first context that produced useful results.
	  (when (and vars firstusefulstart)
	    (let ((end (save-excursion
			 (goto-char firstusefulstart)
			 (save-excursion
			   (unless (semantic-end-of-context)
			     (point))))))
	      ;;(message "Caching values %d->%d." firstusefulstart end)
	      (semantic-cache-data-to-buffer
	       (current-buffer) firstusefulstart
	       (or end
		   ;; If the end-of-context fails,
		   ;; just use our cursor starting
		   ;; position.
		   start)
	       vars 'get-local-variables 'exit-cache-zone))
	    )
	  ;; Return our list.
	  vars)))))