This is a good find!
After making you change, I set up a couple challenging examples to
test against, and found and fixed a different bug elsewhere in the
code too when looking up data types.
I've updated semantic-analyze.el in CVS. Since an extra difficult
test loop was being made, I combined the two tests into one loop.
Try it out and let me know how it goes.
>>> "Jamie Macbeth" <macbeth@...> seems to think that:
>I really dig the intellisense functionality of semantic. I want to
>try to fix what i think is a bug within
>semantic-analyze-possible-completions-default. I discovered that in
>my c code, when i try to complete on the right side of an assignment
>A foo, bar;
>foo.member = ba
>semantic usually has no completions. it should complete bar. it
>looks like semantic is correctly parsing the left half of the
>assignment and comes up with a type constraint for the right side of
>the assignment. in semantic-analyze-possible-completions-default, the
>result of semantic-analyze-type-constraint is contained in
>"desired-type." if the completion tag "bar" is not the same type as
>"member" in the above code, it tries to determine if bar might be a
>compound type using this code ...
> ;; Now anything that is a compound type which could contain
> ;; additional things which are of the desired type
> (setq c (append c (semantic-find-tags-of-compound-type origc)))
>The problem is that semantic-find-tags-of-compound-type tries to find
>a "members" field and a tag doesn't seem to have a "members" field. i
>replaced this bit of code with the result from a full analysis of the
>tag. it seems to work. sorry if it's cumbersome and inefficient ...
>i'm a beginner at elisp
> (setq c (append c
> (function (lambda (x)
> (if (semantic-tag-type-members
> (semantic-analyze-tag-type x (oref a scope)))
> )) origc )))
>is there a more elegant way to do this? please point me in the write
>direction and i can send a better patch. Also, I think we should
>include the tag if it isn't in the database, because it may or may not
>have members. we may not know, right?
[ ... ]
Eric Ludlam: zappo@..., eric@...
Home: http://www.ludlam.net Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org