Commit e8fc8503 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Don't search for the canonical symbol in the base classes (at least for now).

parent bb263645
...@@ -504,10 +504,12 @@ void LookupContext::expand(Scope *scope, ...@@ -504,10 +504,12 @@ void LookupContext::expand(Scope *scope,
Symbol *LookupContext::canonicalSymbol(Symbol *symbol) Symbol *LookupContext::canonicalSymbol(Symbol *symbol)
{ {
Symbol *canonical = symbol; Symbol *canonical = symbol;
for (; symbol; symbol = symbol->next()) { for (; symbol; symbol = symbol->next()) {
if (symbol->name() == canonical->name()) if (symbol->name() == canonical->name())
canonical = symbol; canonical = symbol;
} }
return canonical; return canonical;
} }
...@@ -516,35 +518,16 @@ Symbol *LookupContext::canonicalSymbol(const QList<Symbol *> &candidates) ...@@ -516,35 +518,16 @@ Symbol *LookupContext::canonicalSymbol(const QList<Symbol *> &candidates)
if (candidates.isEmpty()) if (candidates.isEmpty())
return 0; return 0;
Symbol *candidate = candidates.first(); return canonicalSymbol(candidates.first());
if (candidate->scope()->isClassScope() && candidate->type()->isFunctionType()) {
Function *function = 0;
for (int i = 0; i < candidates.size(); ++i) {
Symbol *c = candidates.at(i);
if (! c->scope()->isClassScope())
continue;
else if (Function *f = c->type()->asFunctionType()) {
if (f->isVirtual())
function = f;
}
}
if (function)
return canonicalSymbol(function);
}
return canonicalSymbol(candidate);
} }
Symbol *LookupContext::canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &results) Symbol *LookupContext::canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &results)
{ {
QList<Symbol *> candidates; QList<Symbol *> candidates;
QPair<FullySpecifiedType, Symbol *> result; QPair<FullySpecifiedType, Symbol *> result;
foreach (result, results) {
foreach (result, results)
candidates.append(result.second); // ### not exacly. candidates.append(result.second); // ### not exacly.
}
return canonicalSymbol(candidates); return canonicalSymbol(candidates);
} }
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