* @return Whether the declaration represented by identifier @p identifier qualifies as completion result * * For example, we don't want to offer SomeClass::SomeClass as completion item to the user * (otherwise we'd end up generating code such as 's.SomeClass();') */
| 628 | * (otherwise we'd end up generating code such as 's.SomeClass();') |
| 629 | */ |
| 630 | bool isValidCompletionIdentifier(const QualifiedIdentifier& identifier) |
| 631 | { |
| 632 | const int count = identifier.count(); |
| 633 | if (identifier.count() < 2) { |
| 634 | return true; |
| 635 | } |
| 636 | |
| 637 | const Identifier scope = identifier.at(count-2); |
| 638 | const Identifier id = identifier.last(); |
| 639 | if (scope == id) { |
| 640 | return false; // is constructor |
| 641 | } |
| 642 | const QString idString = id.toString(); |
| 643 | if (idString.startsWith(QLatin1Char('~')) && scope.toString() == QStringView{idString}.sliced(1)) { |
| 644 | return false; // is destructor |
| 645 | } |
| 646 | return true; |
| 647 | } |
| 648 | |
| 649 | /** |
| 650 | * @return Whether the declaration represented by identifier @p identifier qualifies as "special" completion result |
no test coverage detected