unsure functions

Sven Brauch svenbrauch at googlemail.com
Wed Jun 22 19:11:26 UTC 2011


Hi,

unlike most other languages, in Python you can do something like this:

def foo(): pass
foo = 3

This will define a function "foo", then overwrite it with an integer
value. I'm currently facing problems with the DUChain while trying to
support this, as it doesn't seem to offer a sane way to do such things
-- I create a FunctionDeclaration first, but I then cannot change its
type to unsure<the function, int>, because it expects a FunctionType,
not unsure (just displays "Invalid Type" in the tooltip, then).
Is there a way to handle such things in the DUChain currently? Does
anyone have a good idea about what could be added to support this
properly? If not, I'd try adding something like a "callableObject"
declaration, which would be similar to a FunctionDeclaration but more
flexible (and which would also allow unsure as type).

Greetings,
Sven




More information about the KDevelop-devel mailing list