| 585 | } |
| 586 | |
| 587 | int adjustPriorityForType(const AbstractType::Ptr& type, int completionPriority) |
| 588 | { |
| 589 | const auto modifier = 4; |
| 590 | if (type) { |
| 591 | const auto whichType = type->whichType(); |
| 592 | if (whichType == AbstractType::TypePointer || whichType == AbstractType::TypeReference) { |
| 593 | // Clang considers all pointers as similar, this is not what we want. |
| 594 | completionPriority += modifier; |
| 595 | } else if (whichType == AbstractType::TypeStructure) { |
| 596 | // Clang considers all classes as similar too... |
| 597 | completionPriority += modifier; |
| 598 | } else if (whichType == AbstractType::TypeDelayed) { |
| 599 | completionPriority += modifier; |
| 600 | } else if (whichType == AbstractType::TypeAlias) { |
| 601 | auto aliasedType = type.staticCast<TypeAliasType>(); |
| 602 | return adjustPriorityForType(aliasedType->type(), completionPriority); |
| 603 | } else if (whichType == AbstractType::TypeFunction) { |
| 604 | auto functionType = type.staticCast<FunctionType>(); |
| 605 | return adjustPriorityForType(functionType->returnType(), completionPriority); |
| 606 | } |
| 607 | } else { |
| 608 | completionPriority += modifier; |
| 609 | } |
| 610 | |
| 611 | return completionPriority; |
| 612 | } |
| 613 | |
| 614 | /// Adjusts priority for the @p decl |
| 615 | int adjustPriorityForDeclaration(Declaration* decl, int completionPriority) |
no test coverage detected