"Try the base, and if that fails, return what we are assigning into."
(or (cl-call-next-method) (car-safe (oref context :assignee))))
+;;; TYPE MEMBERS
+;;
+;; When analyzing tag sequences, we dive through structured data
+;; such as structs, classes, unions, etc. The raw member list
+;; is sometimes insufficient for generating completions, so each
+;; language needs an opportunity to get the type members that are
+;; accessable via a code snippet. A key example is anonymous
+;; unions in C/C++, whose members are completable in the parent
+;; member list, but are structured in the tag as a single item.
+(define-overloadable-function semantic-analyze-tag-type-members (tag)
+ "Return a list of members of TAG, where TAG is a type.
+By default, call `semantic-tag-type-members'.")
+
+(defun semantic-analyze-tag-type-members-default (tag)
+ "Return a list of members of TAG, where TAG is a type."
+ (semantic-tag-type-members tag))
+
;;; ANALYSIS
;;
;; Start out with routines that will calculate useful parts of
(when miniscope
(let ((rawscope
(apply 'append
- (mapcar 'semantic-tag-type-members tagtype))))
+ (mapcar 'semantic-analyze-tag-type-members tagtype))))
(oset miniscope fullscope rawscope)))
)
(setq s (cdr s)))
;; the found datatype.
(setq fcn (semantic-find-tags-by-name
(semantic-tag-name (car ty))
- (semantic-tag-type-members (car ty))))
+ (semantic-analyze-tag-type-members (car ty))))
(if fcn
(let ((lp fcn))
(while lp
(princ "\nKnown members of ")
(princ (semantic-tag-name dt))
(princ ":\n")
- (dolist (M (semantic-tag-type-members dt))
+ (dolist (M (semantic-analyze-tag-type-members dt))
(princ " ")
;;(princ (semantic-format-tag-prototype M))
(semantic-analyzer-debug-insert-tag M)
;; the next set of members.
(if (not ans)
(setq notdone nil)
- (setq stream (semantic-tag-type-members ans)))
+ ;; When pulling the next stream, only get the members we
+ ;; are supposed to complete on.
+ (setq stream (semantic-analyze-tag-type-members ans)))
(setq lastans ans
ans nil
"Return a list of slots that are valid completions from the list of SLOTS.
If a tag in SLOTS has a named parent, then that implies that the
tag is not something you can complete from within TYPE."
- (let ((allslots (semantic-tag-components type))
+ ;; Pull in analyzed type members.
+ ;; For C, this strips out anon unions, and merges in anon union members.
+ (let ((allslots (semantic-analyze-tag-type-members type))
(leftover nil)
)
(dolist (S allslots)
(if (not ans)
(setq typescoperaw nil)
(when (cdr namesplit)
- (setq typescoperaw (semantic-tag-type-members
+ (setq typescoperaw (semantic-analyze-tag-type-members
(car ans)))))
(setq namesplit (cdr namesplit)))