Review Request: Add possibility to store Decorators for class- and function declarations

Milian Wolff mail at milianw.de
Fri Mar 16 16:04:55 UTC 2012



> On Sept. 2, 2011, 10:01 a.m., David Nolden wrote:
> > This should not be added to the standard KDevelop::Declaration class, because an additional appended-list is a quite heavy addition.
> > In general, every decorator simply describes some attribute, like for example "virtual" in C++, no? So the question is, why do you want to abstract them away into decorator-list, instead of for example creating a "PythonDeclaration" which has a "bool isAbstractMethod()"? (of course only for the decorators/attributes which are interesting to you)
> 
> Sven Brauch wrote:
>     Okay, I see your point.
>     No, decorators are not like attribute keywords, because there's no fixed set of decorators. It's only a syntax for calling a function, if you want to put it like that. Many frameworks (like SQLAlchemy, Django, ...) introduce decorators to modify methods and classes, and it would be useful to track that. As the set of decorators can change at any time (you can even define your own ones) this can not be solved by adding some enum flags to a declaration. See my previous post for a simple custom example.
>     
>     If I want to put this into python only, I'll need to subclass Declaration and add an appended list to it. However, Declaration already defines appended lists. What's the syntax for adding another one? I couldn't find any example for that, and I didn't manage to do it by myself, either.
>     
>     Thanks,
>     Sven

Sven, this is in python now and hence this review request can be closed, or?


- Milian


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


On Aug. 25, 2011, 1:22 p.m., Sven Brauch wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102432/
> -----------------------------------------------------------
> 
> (Updated Aug. 25, 2011, 1:22 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Description
> -------
> 
> This adds a list of Decorators to each class and function declaration, and a Decorator class which stores information about those decorators.
> This is currently relevant for the python language, which has a pattern like this:
> 
> class c():
>     @staticmethod
>     def foo():
>         pass
> 
> I didn't have an internet connection for research available, but I think other languages might have similar patterns, so this can go into kdevplatform.
> Also, even after several hours of experimentation I couldn't figure out how to inherit from a class which defines appended lists, adding another one... some documentation on that would be appreciated :)
> 
> 
> Diffs
> -----
> 
>   language/CMakeLists.txt 4399ebb 
>   language/duchain/classdeclaration.h 409a3a4 
>   language/duchain/classdeclaration.cpp 0670209 
>   language/duchain/decorator.h PRE-CREATION 
>   language/duchain/functiondeclaration.h 7f084a9 
>   language/duchain/functiondeclaration.cpp fb442dc 
> 
> Diff: http://git.reviewboard.kde.org/r/102432/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sven Brauch
> 
>

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


More information about the KDevelop-devel mailing list