Inconsistent behaviour of AliasDeclarations + DUContext::localDeclarations()?

Sven Brauch svenbrauch at googlemail.com
Sun Apr 15 20:27:48 UTC 2012


Okay, then I will fix that and introduce a search flag for the other
thing, and submit a patch. Thanks again. :)

Am 15. April 2012 22:18 schrieb David Nolden <zwabel at googlemail.com>:
> Am 15. April 2012 21:08 schrieb Sven Brauch <svenbrauch at googlemail.com>:
>> Hello David,
>>
>> thanks for your answer. Yes, I meant that
>> findLocalDeclarationsInternal function, as you said; but I didn't find
>> a reference to it in functions like allDeclarations(), so I assumed
>> something else was used there.
>> I'll just add two new search flags then, that's fine.
>>
>> Regarding the range check, tough: Yes, it checks whether the *aliased*
>> declaration is created before the current position, but it doesn't
>> verify that for the declaration itself in case of an alias
>> declaration. If you have code like this:
>>
>> # a.py
>> class foo: pass
>> # b.py
>> import a
>> bar = foo # creates an alias to "foo" in "a.py"
>>
>> then it will currently compare the position of *foo* with the current
>> cursor, instead of comparing the position of *bar* with the current
>> cursor, which would make sense (i.e. it will compare cursors from two
>> different top-contexts, which is not useful in any case). This is
>> because the declaration is just replaced by its aliasedDeclaration if
>> it's an alias before the check is performed. Or do I misunderstand
>> something here? If not, is the second search flag (for the range/top
>> context check) really necessary, or is this behaviour desired in
>> general? In that case, it would probably make sense to check the range
>> of the original declaration instead of checking the aliased
>> declaration.
>> Still, if you feel this might screw something up, I'm also happy to
>> add a flag instead.
>
> Ah yes, that check is actually broken. It should check the position of
> the declaration before aliasing I guess.
>
> --
> KDevelop-devel mailing list
> KDevelop-devel at kdevelop.org
> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel




More information about the KDevelop-devel mailing list