forked from qt-creator/qt-creator
C++: Fix code completion for nested classes
Fix code completion for nested classes when enclosing is template class. Unit tests Task-number: QTCREATORBUG-8245 (only standalone) Change-Id: Ib31ad4b799db927b56debd4dc3e7403404c1839d Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
committed by
hjk
parent
17748280e8
commit
b1199ef0cc
@@ -811,16 +811,17 @@ bool ResolveExpression::visit(MemberAccessAST *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
ClassOrNamespace *ResolveExpression::findClass(const FullySpecifiedType &originalTy, Scope *scope) const
|
||||
ClassOrNamespace *ResolveExpression::findClass(const FullySpecifiedType &originalTy, Scope *scope,
|
||||
ClassOrNamespace* enclosingTemplateInstantiation) const
|
||||
{
|
||||
FullySpecifiedType ty = originalTy.simplified();
|
||||
ClassOrNamespace *binding = 0;
|
||||
|
||||
if (Class *klass = ty->asClassType())
|
||||
binding = _context.lookupType(klass);
|
||||
binding = _context.lookupType(klass, enclosingTemplateInstantiation);
|
||||
|
||||
else if (NamedType *namedTy = ty->asNamedType())
|
||||
binding = _context.lookupType(namedTy->name(), scope);
|
||||
binding = _context.lookupType(namedTy->name(), scope, enclosingTemplateInstantiation);
|
||||
|
||||
else if (Function *funTy = ty->asFunctionType())
|
||||
return findClass(funTy->returnType(), scope);
|
||||
@@ -979,7 +980,13 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
}
|
||||
}
|
||||
|
||||
if (ClassOrNamespace *binding = findClass(ty, scope))
|
||||
ClassOrNamespace *enclosingTemplateInstantiation = 0;
|
||||
if (ClassOrNamespace *binding = r.binding()) {
|
||||
if (binding->instantiationOrigin())
|
||||
enclosingTemplateInstantiation = binding;
|
||||
}
|
||||
|
||||
if (ClassOrNamespace *binding = findClass(ty, scope, enclosingTemplateInstantiation))
|
||||
return binding;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user