C++: fix local types and members

It fixes code model when we have local type which contains a member
of other type, e.g.:
struct OtherType { int otherTypeMember; };
void foo()
{
    struct LocalType
    {
        int localTypeMember;
        OtherType ot;
    };

    LocalType lt;
    lt.ot.//no code completion
}

Change-Id: I018f492a6c48bfcbba0ef376ef005825e2b13f35
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2013-07-04 09:09:35 +02:00
committed by Erik Verbruggen
parent 43a3334347
commit 3cde52846e
3 changed files with 218 additions and 0 deletions

View File

@@ -360,6 +360,15 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
} else if (ClassOrNamespace *b = bindings()->lookupType(scope, enclosingTemplateInstantiation)) {
return b->lookupType(name);
} else if (Class *scopeAsClass = scope->asClass()) {
if (scopeAsClass->enclosingScope()->isBlock()) {
if (ClassOrNamespace *b = lookupType(scopeAsClass->name(),
scopeAsClass->enclosingScope(),
enclosingTemplateInstantiation,
typedefsBeingResolved)) {
return b->lookupType(name);
}
}
}
return 0;