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

David Nolden david.nolden.kde at art-master.de
Sun Jun 26 12:08:07 UTC 2011


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


There must be a bidirectional relation between "importers" and "imported" contexts, so this might cause random crashes and inconsistencies in places where this is assumed. Also, the "m_directImporters" array is not persistent, eg. it isn't re-built correctly after restarting.

I think the best solution would be to simply use one direct import for every package you use, and but to build a namespace-context around each file so they are scoped properly. The ugly full scopes don't need to be shown during code-completion (see Cpp::stripPrefixes).

- David


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/2557a0e2/attachment.html>


More information about the KDevelop-devel mailing list