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

Moved the lookup of qualified name ids in LookupContext::resolveQualifiedNameId()

parent ed02e7ee
......@@ -126,16 +126,13 @@ bool LookupContext::maybeValidSymbol(Symbol *symbol,
return false;
}
QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visibleScopes,
QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
const QList<Scope *> &visibleScopes,
ResolveMode mode) const
{
QList<Scope *> scopes = visibleScopes;
QList<Symbol *> candidates;
if (!name)
return candidates;
if (QualifiedNameId *q = name->asQualifiedNameId()) {
QList<Scope *> scopes = visibleScopes;
for (unsigned i = 0; i < q->nameCount(); ++i) {
Name *name = q->nameAt(i);
......@@ -155,7 +152,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
}
}
Identifier *id = identifier(name);
Identifier *id = q->identifier();
foreach (Scope *scope, visibleScopes) {
Symbol *symbol = scope->lookat(id);
for (; symbol; symbol = symbol->next()) {
......@@ -182,7 +179,18 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
}
return candidates;
}
}
QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visibleScopes,
ResolveMode mode) const
{
QList<Symbol *> candidates;
if (!name)
return candidates;
if (QualifiedNameId *q = name->asQualifiedNameId())
return resolveQualifiedNameId(q, visibleScopes, mode);
if (Identifier *id = identifier(name)) {
for (int scopeIndex = 0; scopeIndex < visibleScopes.size(); ++scopeIndex) {
......
......@@ -115,6 +115,10 @@ public:
QList<Scope *> *expandedScopes) const;
private:
QList<Symbol *> resolveQualifiedNameId(QualifiedNameId *q,
const QList<Scope *> &visibleScopes,
ResolveMode mode) const;
Identifier *identifier(const Name *name) const;
QList<Scope *> buildVisibleScopes();
......
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