Commit 52b062c4 authored by Roberto Raggi's avatar Roberto Raggi

Look only at the viable functions.

parent 5950aedf
...@@ -780,10 +780,6 @@ void CheckSymbols::addType(const QList<LookupItem> &candidates, NameAST *ast) ...@@ -780,10 +780,6 @@ void CheckSymbols::addType(const QList<LookupItem> &candidates, NameAST *ast)
if (tok.generated()) if (tok.generated())
return; return;
unsigned line, column;
getTokenStartPosition(startToken, &line, &column);
const unsigned length = tok.length();
foreach (const LookupItem &r, candidates) { foreach (const LookupItem &r, candidates) {
Symbol *c = r.declaration(); Symbol *c = r.declaration();
if (c->isUsingDeclaration()) // skip using declarations... if (c->isUsingDeclaration()) // skip using declarations...
...@@ -793,6 +789,11 @@ void CheckSymbols::addType(const QList<LookupItem> &candidates, NameAST *ast) ...@@ -793,6 +789,11 @@ void CheckSymbols::addType(const QList<LookupItem> &candidates, NameAST *ast)
else if (c->isTypedef() || c->isNamespace() || else if (c->isTypedef() || c->isNamespace() ||
c->isClass() || c->isEnum() || c->isClass() || c->isEnum() ||
c->isForwardClassDeclaration() || c->isTypenameArgument()) { c->isForwardClassDeclaration() || c->isTypenameArgument()) {
unsigned line, column;
getTokenStartPosition(startToken, &line, &column);
const unsigned length = tok.length();
const Use use(line, column, length, Use::Type); const Use use(line, column, length, Use::Type);
addUse(use); addUse(use);
//qDebug() << "added use" << oo(ast->name) << line << column << length; //qDebug() << "added use" << oo(ast->name) << line << column << length;
...@@ -811,10 +812,6 @@ void CheckSymbols::addClassMember(const QList<LookupItem> &candidates, NameAST * ...@@ -811,10 +812,6 @@ void CheckSymbols::addClassMember(const QList<LookupItem> &candidates, NameAST *
if (tok.generated()) if (tok.generated())
return; return;
unsigned line, column;
getTokenStartPosition(startToken, &line, &column);
const unsigned length = tok.length();
foreach (const LookupItem &r, candidates) { foreach (const LookupItem &r, candidates) {
Symbol *c = r.declaration(); Symbol *c = r.declaration();
if (! c) if (! c)
...@@ -826,6 +823,10 @@ void CheckSymbols::addClassMember(const QList<LookupItem> &candidates, NameAST * ...@@ -826,6 +823,10 @@ void CheckSymbols::addClassMember(const QList<LookupItem> &candidates, NameAST *
else if (c->isTypedef() || c->type()->isFunctionType()) else if (c->isTypedef() || c->type()->isFunctionType())
return; // shadowed return; // shadowed
unsigned line, column;
getTokenStartPosition(startToken, &line, &column);
const unsigned length = tok.length();
const Use use(line, column, length, Use::Field); const Use use(line, column, length, Use::Field);
addUse(use); addUse(use);
break; break;
...@@ -842,10 +843,6 @@ void CheckSymbols::addVirtualMethod(const QList<LookupItem> &candidates, NameAST ...@@ -842,10 +843,6 @@ void CheckSymbols::addVirtualMethod(const QList<LookupItem> &candidates, NameAST
if (tok.generated()) if (tok.generated())
return; return;
unsigned line, column;
getTokenStartPosition(startToken, &line, &column);
const unsigned length = tok.length();
foreach (const LookupItem &r, candidates) { foreach (const LookupItem &r, candidates) {
Symbol *c = r.declaration(); Symbol *c = r.declaration();
if (! c) if (! c)
...@@ -858,6 +855,14 @@ void CheckSymbols::addVirtualMethod(const QList<LookupItem> &candidates, NameAST ...@@ -858,6 +855,14 @@ void CheckSymbols::addVirtualMethod(const QList<LookupItem> &candidates, NameAST
continue; continue;
else if (argumentCount < funTy->minimumArgumentCount()) else if (argumentCount < funTy->minimumArgumentCount())
continue; continue;
else if (argumentCount > funTy->argumentCount()) {
if (! funTy->isVariadic())
continue;
}
unsigned line, column;
getTokenStartPosition(startToken, &line, &column);
const unsigned length = tok.length();
const Use use(line, column, length, Use::VirtualMethod); const Use use(line, column, length, Use::VirtualMethod);
addUse(use); addUse(use);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment