Function: semantic-analyze-scope-calculate-access-default

semantic-analyze-scope-calculate-access-default is a byte-compiled function defined in scope.el.gz.

Signature

(semantic-analyze-scope-calculate-access-default TYPE SCOPE)

Documentation

Calculate the access class for TYPE as defined by the current SCOPE.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/scope.el.gz
(defun semantic-analyze-scope-calculate-access-default (type scope)
  "Calculate the access class for TYPE as defined by the current SCOPE."
  (cond ((semantic-scope-cache-p scope)
	 (let ((parents (oref scope parents))
	       (parentsi (oref scope parentinheritance))
	       )
	   (catch 'moose
	     ;; Investigate the parent, and see how it relates to type.
	     ;; If these tags are basically the same, then we have full access.
	     (dolist (p parents)
	       (when (semantic-tag-similar-p type p)
		 (throw 'moose 'private))
	       )
	     ;; Look to see if type is in our list of inherited parents.
	     (dolist (pi parentsi)
	       ;; pi is a cons cell ( PARENT . protection)
	       (let ((pip (car pi))
		     (piprot (cdr pi)))
		 (when (semantic-tag-similar-p type pip)
		   (throw 'moose
			  ;; protection via inheritance means to pull out different
			  ;; bits based on protection labels in an opposite way.
			  (cdr (assoc piprot
				      '((public . private)
					(protected . protected)
					(private . public))))
			  )))
	       )
	     ;; Not in our parentage.  Is type a FRIEND?
	     (let ((friends (semantic-find-tags-by-class 'friend (semantic-tag-type-members type))))
	       (dolist (F friends)
		 (dolist (pi parents)
		   (if (string= (semantic-tag-name F) (semantic-tag-name pi))
		       (throw 'moose 'private))
		   )))
	     ;; Found nothing, return public
	     'public)
	   ))
	(t 'public)))