[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/last-cedet-merge 6b57c5b 20/37: semantic: Introduc
From: |
David Engster |
Subject: |
[Emacs-diffs] scratch/last-cedet-merge 6b57c5b 20/37: semantic: Introduce `semantic-analyze-tag-type-members' |
Date: |
Sun, 22 Jan 2017 21:26:32 +0000 (UTC) |
branch: scratch/last-cedet-merge
commit 6b57c5bb80239dd545c319b45de7f288b3a260a2
Author: Eric Ludlam <address@hidden>
Commit: David Engster <address@hidden>
semantic: Introduce `semantic-analyze-tag-type-members'
* lisp/cedet/semantic/analyze.el (semantic-analyze-tag-type-members)
(semantic-analyze-tag-type-members-default): New
(semantic-analyze-find-tag-sequence-default)
(semantic-analyze-current-context-default):
* lisp/cedet/semantic/db-typecache.el
(semanticdb-typecache-find):
* lisp/cedet/semantic/scope.el (semantic-completable-tags-from-type)
(semantic-scope-find):
* lisp/cedet/semantic/analyze/complete.el
(semantic-analyze-possible-completions-default):
* lisp/cedet/semantic/analyze/debug.el
(semantic-analyzer-debug-missing-innertype): Use new
`semantic-analyze-tag-type-members'.
---
lisp/cedet/semantic/analyze.el | 21 +++++++++++++++++++--
lisp/cedet/semantic/analyze/complete.el | 2 +-
lisp/cedet/semantic/analyze/debug.el | 2 +-
lisp/cedet/semantic/db-typecache.el | 4 +++-
lisp/cedet/semantic/scope.el | 6 ++++--
5 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el
index c7062fb..a8cd95d 100644
--- a/lisp/cedet/semantic/analyze.el
+++ b/lisp/cedet/semantic/analyze.el
@@ -219,6 +219,23 @@ Optional argument DESIRED-TYPE may be a non-type tag to
analyze."
"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
@@ -345,7 +362,7 @@ This function knows of flags:
(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)))
@@ -589,7 +606,7 @@ Returns an object based on symbol
`semantic-analyze-context'."
;; 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
diff --git a/lisp/cedet/semantic/analyze/complete.el
b/lisp/cedet/semantic/analyze/complete.el
index 1ddbe13..f99a70b 100644
--- a/lisp/cedet/semantic/analyze/complete.el
+++ b/lisp/cedet/semantic/analyze/complete.el
@@ -235,7 +235,7 @@ FLAGS can be any number of:
((semantic-tag-type (car loopc))
(let ((att (semantic-analyze-tag-type (car loopc) scope))
)
- (if (and att (semantic-tag-type-members att))
+ (if (and att (semantic-analyze-tag-type-members att))
(setq c (cons (car loopc) c))))
)
diff --git a/lisp/cedet/semantic/analyze/debug.el
b/lisp/cedet/semantic/analyze/debug.el
index fd218b6..eb4e994 100644
--- a/lisp/cedet/semantic/analyze/debug.el
+++ b/lisp/cedet/semantic/analyze/debug.el
@@ -307,7 +307,7 @@ possible completions for \"")
(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)
diff --git a/lisp/cedet/semantic/db-typecache.el
b/lisp/cedet/semantic/db-typecache.el
index 8c8cf15..48e439e 100644
--- a/lisp/cedet/semantic/db-typecache.el
+++ b/lisp/cedet/semantic/db-typecache.el
@@ -499,7 +499,9 @@ found tag to be loaded."
;; 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
diff --git a/lisp/cedet/semantic/scope.el b/lisp/cedet/semantic/scope.el
index 272f37d..0ac994c 100644
--- a/lisp/cedet/semantic/scope.el
+++ b/lisp/cedet/semantic/scope.el
@@ -508,7 +508,9 @@ the access would be 'protected. Otherwise, access is
'public")
"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)
@@ -819,7 +821,7 @@ hits in order, with the first tag being in the closest
scope."
(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)))
- [Emacs-diffs] scratch/last-cedet-merge 5d6f4b8 05/37: EDE: Fix slot type in ede-proj-target-makefile, (continued)
- [Emacs-diffs] scratch/last-cedet-merge 5d6f4b8 05/37: EDE: Fix slot type in ede-proj-target-makefile, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge ec4505d 17/37: semantic: Accept FLAGS in texinfo-mode for analyzing completions, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 0391760 13/37: semantic: Do not strip '*' from operator, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge c2d4ad8 23/37: semantic: Update keybinings for grammar mode, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 7308eaf 18/37: semantic: Accept FLAGS parameter for makefile-mode for analyzing completions, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge cc30b46 11/37: EDE: Move ede-global-list-sanity-check to ede/files.el, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 95f8a69 29/37: semantic: More C grammar optimizations, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 2b42323 35/37: EDE: Fix for project detection, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge b4d1399 14/37: EDE: Rework config file detection, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge deaa8c9 24/37: semantic: New function to find library with macro definition, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 6b57c5b 20/37: semantic: Introduce `semantic-analyze-tag-type-members',
David Engster <=
- [Emacs-diffs] scratch/last-cedet-merge 0a2b38b 26/37: EDE: Expand file name, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge fb127f2 34/37: semantic: C grammar fixes, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge f11e08f 10/37: semantic: Fix wisent parser recursion, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 47471b9 12/37: EDE: Add missing require and silence byte compiler, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 6ca095c 21/37: semantic: Add autoload for Add autoload for `semantic-analyze-debug-assist', David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 5cb7aed 22/37: semantic: New c-mode override for analyzing tag type members, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 8571383 16/37: semantic: Incorporate local scope when finding type, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 74263b1 37/37: semantic: Change unary expression rule, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge 03c5f0d 25/37: semantic: Add more syntax modifications for scheme lexer, David Engster, 2017/01/22
- [Emacs-diffs] scratch/last-cedet-merge ebc59a5 19/37: semantic: Accept FLAGS parameter for srecode-template-mode, David Engster, 2017/01/22