Review Request: Extend KDevPlatform API a bit to allow custom import strategies

Sven Brauch svenbrauch at gmx.de
Sun Jun 26 13:47:45 UTC 2011



> On June 25, 2011, 9:19 a.m., Milian Wolff wrote:
> > Wait a sec, shouldn't you create an AliasDeclaration in that case (instead of actually importing the declaration from some other topcontext)? I mean the "using" directive in Cpp is more or less the same, and it works there, no? Why does that not work for you?
> 
> Sven Brauch wrote:
>     I do create an AliasDeclaration, but the aliasedDeclaration() of that declaration might be in another top-context which has not necessarily anything to do with the one the AliasDeclaration is created in. Thus, as soon as the every-200-second cleanup is run, the topContext the aliasedDeclaration() is from may be cleaned, leaving me with a "(lost alias foo)" thingy in the original file. Isn't this the correct approach to solve that issue?
>     
>     Bye,
>     Sven
> 
> David Nolden wrote:
>     Ah, actually, you shouldn't even need to import the top-context for the aliasDeclaration to properly survive the cleanup. IndexedDeclaration is (should be) persistent among cleanups and unloading/loading. So you need to find out why this isn't the case.

Oh, okay, so you'd say the whole approach is unnecessary, as it should work anyways? That's interesting, I'll try to investiage that. Thanks!


- Sven


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/101754/#review4142
-----------------------------------------------------------


On June 25, 2011, 12:40 a.m., Sven Brauch wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/101754/
> -----------------------------------------------------------
> 
> (Updated June 25, 2011, 12:40 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Summary
> -------
> 
> This adds two small functions to the API which make it possible to manually add contexts to a topContexts importer map. Python language support makes use of this in the following case:
> 
> When importing a single declaration from a given top-context -- like required for the following: "from x import foo", which imports the declaration "foo" from the module "x" -- the context a declaration was taken from needs to be tracked, so it will not be auto-cleaned (making the importing context lose alias declarations). Using a function like addImportedParentContext() would do this automatically, but for obvious reasons those functions do not work in this case (because only a single declaration should be imported, not a whole context).
> 
> 
> Diffs
> -----
> 
>   language/duchain/topducontext.h 6198a8f 
>   language/duchain/topducontext.cpp 402bd34 
> 
> Diff: http://git.reviewboard.kde.org/r/101754/diff
> 
> 
> Testing
> -------
> 
> Seems to work in my case, and should not break anything as it just adds two small functions, not touching existing functionality.
> 
> 
> Thanks,
> 
> Sven
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110626/311cce43/attachment.html>


More information about the KDevelop-devel mailing list