Distinguishing between "instance of class" and "class" types in the duchain

Milian Wolff mail at milianw.de
Mon Apr 9 21:02:38 UTC 2012


On Monday 09 April 2012 22:32:02 Sven Brauch wrote:
> Hello there,
> 
> there's something I'm unsure about how to correctly represent it in
> the duchain: the difference between "class" and "instance of a class".
> My current solution is that a class declaration creates a structure
> type, and if I want to reference the class itself (not an instance of
> the class) I create an alias declaration which aliases the class
> declaration. That is not really optimal for several reasons tough:
> there's always the need to search for declarations if you work with
> types, e.g. if handling an assignment, you cannot simply assign B the
> type of A, but you have to check if A is a class or an instance of a
> class, then create an alias declaration or something else depending on
> that... etc; additionaly, it's not possible to store class types in
> unsure types that way (a declaration cannot have an unsure type which
> could either be a class or None, or similar).
> 
> Is there a good way to do this?
> Is there a good *idea* which I could implement in the duchain to solve
> this problem? It's really messy right now.

In PHP and C++ we just assign the "raw" structuretype to instances. To figure 
out if you actually have a declaration, you can either cast to 
ClassDeclaration or compare the declaration of the structuretype. Why does 
that not work for you?

bye

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20120409/0d11ef80/attachment.sig>


More information about the KDevelop-devel mailing list