Re: [CEDET-devel] Make name of parent class fully qualified if necessary
Brought to you by:
zappo
From: David E. <de...@ra...> - 2009-07-23 14:14:53
|
Hi Eric, Eric M. Ludlam <er...@si...> writes: > The function in question is semantic-analyze-scoped-inherited-tag-map, > around line 595 where it calls back out to the analyzer to find the > tag. The SCOPE that is passed in is the scope for where the > completion is being done, while it probably should be the scope for > where the type TYPE is. I have no idea what would happen if you > create a scope for some other location while fabricating a local > scope. Ah, OK. I'm not so sure semantic-scope is the right place, since at least to me this problem seems fairly specific to C++, and therefore should better go into semantic-c? Anyway, I played around with semantic-analyze-scoped-inherited-tag-map, and if the namespaces are declared in the same file I can simply get them from TYPE's scope: --- a/semantic/semantic-scope.el +++ b/semantic/semantic-scope.el @@ -583,7 +583,7 @@ whose tags can be searched when needed, OR it may be a scope object." ;; interfaces. Inheriting from an interfaces implies ;; you have a copy of all methods locally. I think. (parents (semantic-tag-type-superclasses type)) - ps pt + ps newps pt sc ) (dolist (p parents) (setq ps (cond ((stringp p) p) @@ -592,7 +592,21 @@ whose tags can be searched when needed, OR it may be a scope object." ((and (listp p) (stringp (car p))) p)) pt (condition-case nil - (semantic-analyze-find-tag ps 'type scope) + (progn + (setq newps ps) + (when (and (stringp (semantic-analyze-split-name ps)) + (setq sc (semantic-scope-tag-get-scope type)) + (setq sc (reverse (semantic-find-tags-by-type "namespace" sc)))) + (while sc + ;; Check if parent is member of that namespace. + (when (semantic-deep-find-tags-by-name + ps (semantic-tag-type-members (car sc))) + (when (stringp (setq newps (semantic-analyze-split-name newps))) + (setq newps (list newps))) + ;; Make it fully qualified + (setq newps (semantic-analyze-unsplit-name (append (list (semantic-tag-name (car sc))) newps)))) + (setq sc (cdr sc)))) + (semantic-analyze-find-tag newps 'type scope)) (error nil))) (when pt (funcall fcn pt) However, I'm not sure what to do when the namespaces are declared in an external header. > What I like about your patch is the idea of converting things into a > fully qualified name. It seems like it would simplify several problems. > Doing so, however, doesn't seem to make it possible to skip the task I > mention above, as there are many ways to say the same thing, and you > have to search each possibility as opposed to just guessing at one > particular solution. Well, I'm not really guessing, since the namespace is given in the type-declaration (which has a fully qualified name). Also, the dereferencer was at least able to deal with the posted problem without any change to semantic-scope. > Anyway, that's what I know off the top of my head. I didn't analyze > your patch as my kids keep interrupting and I can't seem to keep a > straight thought in my head today. Yet another problem with child classes... ;-) -David |