forked from qt-creator/qt-creator
Introduced an overload of reportResult() that can deal with strong and weak results.
This commit is contained in:
@@ -115,6 +115,14 @@ protected:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reportResult(unsigned tokenIndex, const QList<Symbol *> &candidates)
|
||||||
|
{
|
||||||
|
const bool isStrongResult = checkCandidates(candidates);
|
||||||
|
|
||||||
|
if (isStrongResult)
|
||||||
|
reportResult(tokenIndex);
|
||||||
|
}
|
||||||
|
|
||||||
void reportResult(unsigned tokenIndex)
|
void reportResult(unsigned tokenIndex)
|
||||||
{
|
{
|
||||||
const Token &tk = tokenAt(tokenIndex);
|
const Token &tk = tokenAt(tokenIndex);
|
||||||
@@ -130,7 +138,7 @@ protected:
|
|||||||
|
|
||||||
if (_future)
|
if (_future)
|
||||||
_future->reportResult(Utils::FileSearchResult(QDir::toNativeSeparators(_doc->fileName()),
|
_future->reportResult(Utils::FileSearchResult(QDir::toNativeSeparators(_doc->fileName()),
|
||||||
line, lineText, col, len));
|
line, lineText, col, len));
|
||||||
|
|
||||||
_references.append(tokenIndex);
|
_references.append(tokenIndex);
|
||||||
}
|
}
|
||||||
@@ -197,8 +205,7 @@ protected:
|
|||||||
if (identifier(simple->identifier_token) == _id) {
|
if (identifier(simple->identifier_token) == _id) {
|
||||||
LookupContext context = currentContext(ast);
|
LookupContext context = currentContext(ast);
|
||||||
const QList<Symbol *> candidates = context.resolve(simple->name);
|
const QList<Symbol *> candidates = context.resolve(simple->name);
|
||||||
if (checkCandidates(candidates))
|
reportResult(simple->identifier_token, candidates);
|
||||||
reportResult(simple->identifier_token);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
accept(ast->expression);
|
accept(ast->expression);
|
||||||
@@ -262,8 +269,7 @@ protected:
|
|||||||
candidates.append(lastVisibleSymbol);
|
candidates.append(lastVisibleSymbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkCandidates(candidates))
|
reportResult(endToken, candidates);
|
||||||
reportResult(endToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool visit(QualifiedNameAST *ast)
|
virtual bool visit(QualifiedNameAST *ast)
|
||||||
@@ -331,8 +337,7 @@ protected:
|
|||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
LookupContext context = currentContext(ast);
|
LookupContext context = currentContext(ast);
|
||||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||||
if (checkCandidates(candidates))
|
reportResult(ast->identifier_token, candidates);
|
||||||
reportResult(ast->identifier_token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -344,8 +349,7 @@ protected:
|
|||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
LookupContext context = currentContext(ast);
|
LookupContext context = currentContext(ast);
|
||||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||||
if (checkCandidates(candidates))
|
reportResult(ast->identifier_token, candidates);
|
||||||
reportResult(ast->identifier_token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -357,8 +361,7 @@ protected:
|
|||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
LookupContext context = currentContext(ast);
|
LookupContext context = currentContext(ast);
|
||||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||||
if (checkCandidates(candidates))
|
reportResult(ast->identifier_token, candidates);
|
||||||
reportResult(ast->identifier_token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user