Review Request: Allow to mark Declaration instances as "automatically created"

David Nolden david.nolden.kde at art-master.de
Wed Mar 23 14:37:11 UTC 2011


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



language/duchain/ducontext.cpp
<http://git.reviewboard.kde.org/r/100936/#comment1751>

    Try adding a DUChain::Uses::hasUses(id) function.
    
    It would be a simplified version of DUChain::Uses::uses():
    Simply insert "return (bool)d->m_uses.findIndex(item);" and remove the unneeded code.
    
    The problem would be though, that this only covers uses which are in a _different_ top-context, so you need another efficient mechanism to see whether there are uses in the current top-context. For this, I think you could use "TopDUContext::indexForUsedDeclaration", with parameter "create=false". You should put this combined functionality into a new "Declaration::hasUses()" function, because it might be useful in other cases too.


- David


On March 23, 2011, 12:12 p.m., Sven Brauch wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/100936/
> -----------------------------------------------------------
> 
> (Updated March 23, 2011, 12:12 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Summary
> -------
> 
> Allow to mark Declaration instances as "automatically created", so they aren't automatically deleted if they weren't encountered while the context containing them was generated. This is useful for languages like python and php, where you can do something like "foo = A(); foo.x=3" without having defined a property named x in the class A previously.
> I'm not sure about the change in ducontext.cpp; maybe that will be too slow, I don't know.
> 
> 
> Diffs
> -----
> 
>   language/duchain/declaration.h 92e0c62 
>   language/duchain/declaration.cpp b46e4f1 
>   language/duchain/declarationdata.h 3ae64ba 
>   language/duchain/ducontext.cpp 3ec527b 
>   language/duchain/repositories/itemrepository.cpp c76befd 
> 
> Diff: http://git.reviewboard.kde.org/r/100936/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sven
> 
>

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


More information about the KDevelop-devel mailing list