Changeset View
Changeset View
Standalone View
Standalone View
language/duchain/navigation/abstractincludenavigationcontext.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 42 | foreach(TopDUContext* ctx, duchains) { | |||
---|---|---|---|---|---|
49 | } | 49 | } | ||
50 | if(ctx->localDeclarations().count() != 0 | 50 | if(ctx->localDeclarations().count() != 0 | ||
51 | && (duchain == nullptr || ctx->localDeclarations().count() > duchain->localDeclarations().count())) { | 51 | && (duchain == nullptr || ctx->localDeclarations().count() > duchain->localDeclarations().count())) { | ||
52 | duchain = ctx; | 52 | duchain = ctx; | ||
53 | } | 53 | } | ||
54 | } | 54 | } | ||
55 | 55 | | |||
56 | if(!duchain && maxDepth != 0) { | 56 | if(!duchain && maxDepth != 0) { | ||
57 | if(maxDepth != 0) { | | |||
58 | foreach(TopDUContext* ctx, duchains) { | 57 | foreach(TopDUContext* ctx, duchains) { | ||
59 | QList<TopDUContext*> children; | 58 | QList<TopDUContext*> children; | ||
60 | foreach(const DUContext::Import &import, ctx->importedParentContexts()) | 59 | foreach(const DUContext::Import &import, ctx->importedParentContexts()) | ||
61 | if(import.context(nullptr)) | 60 | if(import.context(nullptr)) | ||
62 | children << import.context(nullptr)->topContext(); | 61 | children << import.context(nullptr)->topContext(); | ||
63 | 62 | | |||
64 | duchain = pickContextWithData(children, maxDepth-1, type, false); | 63 | duchain = pickContextWithData(children, maxDepth-1, type, false); | ||
65 | if(duchain) | 64 | if(duchain) | ||
66 | break; | 65 | break; | ||
67 | } | 66 | } | ||
68 | } | 67 | } | ||
69 | } | | |||
70 | 68 | | |||
71 | if(!duchain && !duchains.isEmpty() && forcePick) | 69 | if(!duchain && !duchains.isEmpty() && forcePick) | ||
72 | duchain = duchains.first(); | 70 | duchain = duchains.first(); | ||
73 | 71 | | |||
74 | return duchain; | 72 | return duchain; | ||
75 | } | 73 | } | ||
76 | 74 | | |||
77 | QString AbstractIncludeNavigationContext::html(bool shorten) | 75 | QString AbstractIncludeNavigationContext::html(bool shorten) | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 136 | while(childIterator != children.constEnd() || declarationIterator != declarations.constEnd()) { | |||
141 | int currentDeclarationLine = -1; | 139 | int currentDeclarationLine = -1; | ||
142 | int currentContextLine = -1; | 140 | int currentContextLine = -1; | ||
143 | if(declarationIterator != declarations.constEnd()) | 141 | if(declarationIterator != declarations.constEnd()) | ||
144 | currentDeclarationLine = (*declarationIterator)->rangeInCurrentRevision().start().line(); | 142 | currentDeclarationLine = (*declarationIterator)->rangeInCurrentRevision().start().line(); | ||
145 | 143 | | |||
146 | if(childIterator != children.constEnd()) | 144 | if(childIterator != children.constEnd()) | ||
147 | currentDeclarationLine = (*childIterator)->rangeInCurrentRevision().start().line(); | 145 | currentDeclarationLine = (*childIterator)->rangeInCurrentRevision().start().line(); | ||
148 | 146 | | |||
149 | if((currentDeclarationLine <= currentContextLine || currentContextLine == -1 || childIterator == children.constEnd()) && declarationIterator != declarations.constEnd() ) | 147 | if((currentDeclarationLine <= currentContextLine || childIterator == children.constEnd()) && declarationIterator != declarations.constEnd() ) | ||
150 | { | 148 | { | ||
151 | IdentifierPair id = qMakePair(static_cast<int>((*declarationIterator)->kind()), | 149 | IdentifierPair id = qMakePair(static_cast<int>((*declarationIterator)->kind()), | ||
152 | (*declarationIterator)->qualifiedIdentifier().index()); | 150 | (*declarationIterator)->qualifiedIdentifier().index()); | ||
153 | if(!addedDeclarations.contains(id) && filterDeclaration(*declarationIterator) ) { | 151 | if(!addedDeclarations.contains(id) && filterDeclaration(*declarationIterator) ) { | ||
154 | //Show the declaration | 152 | //Show the declaration | ||
155 | if(!first) | 153 | if(!first) | ||
156 | modifyHtml() += QStringLiteral(", "); | 154 | modifyHtml() += QStringLiteral(", "); | ||
157 | else | 155 | else | ||
Show All 19 Lines |