RFC: make openDeclaration take an Identifier instead of QualifiedIdentifier
Nicolás Alvarez
nicolas.alvarez at gmail.com
Tue Apr 11 03:10:04 UTC 2017
Hi devs,
I'm trying to improve some suboptimal APIs in KDevPlatform. If we're
not going to keep compatibility from one 5.x to the next, we might as
well use that to our advantage and improve our interfaces.
AbstractDeclarationBuilder::openDeclaration takes a
QualifiedIdentifier. QIDs have multiple components giving the whole
scope of the identifier. However, the first thing openDeclaration does
is Identifier localId = id.last(); keeping the last component of the
QualifiedIdentifier, and then uses that localId to create the
Declaration. The rest of the QID is completely ignored. In addition,
the language plugins I looked at seem to always pass a
QualifiedIdentifier with zero or one components.
So it seems there's no point in having openDeclaration take a
QualifiedIdentifier, and it should take an Identifier instead. It
should be trivial to adjust language plugins to the change; unless
some plugin is passing QualifiedIdentifier(str) where str could be
"foo::bar", in which case the changes could become a bit more
extensive to ensure only the last component is passed to Identifier().
(I think parsing C++-specific syntax like :: in QualifiedIdentifier is
complete nonsense, but that's a whole different topic)
Please let me know agreement/disagreement on the idea and I'll send a patch.
There is a similar "problem" with Contexts, but it's much trickier so
I'll leave it for a separate email.
Bye,
--
Nicolás
More information about the KDevelop-devel
mailing list