| 51 | } |
| 52 | |
| 53 | Declaration* ForwardDeclaration::resolve(const TopDUContext* topContext) const |
| 54 | { |
| 55 | ENSURE_CAN_READ |
| 56 | |
| 57 | //If we've got a type assigned, that counts as a way of resolution. |
| 58 | AbstractType::Ptr t = abstractType(); |
| 59 | auto* idType = dynamic_cast<IdentifiedType*>(t.data()); |
| 60 | if (idType) { |
| 61 | Declaration* decl = idType->declaration(topContext); |
| 62 | if (decl && !decl->isForwardDeclaration()) |
| 63 | return decl; |
| 64 | else |
| 65 | return nullptr; |
| 66 | } |
| 67 | |
| 68 | if (!topContext) |
| 69 | topContext = this->topContext(); |
| 70 | |
| 71 | QualifiedIdentifier globalIdentifier = qualifiedIdentifier(); |
| 72 | globalIdentifier.setExplicitlyGlobal(true); |
| 73 | |
| 74 | //We've got to use DUContext::DirectQualifiedLookup so C++ works correctly. |
| 75 | const QList<Declaration*> declarations = topContext->findDeclarations(globalIdentifier, |
| 76 | CursorInRevision::invalid(), |
| 77 | AbstractType::Ptr(), nullptr, |
| 78 | DUContext::DirectQualifiedLookup); |
| 79 | |
| 80 | for (Declaration* decl : declarations) { |
| 81 | if (!decl->isForwardDeclaration()) |
| 82 | return decl; |
| 83 | } |
| 84 | |
| 85 | return nullptr; |
| 86 | } |
| 87 | |
| 88 | DUContext* ForwardDeclaration::logicalInternalContext(const TopDUContext* topContext) const |
| 89 | { |
no test coverage detected