Fixed: Completion doesn't work for typedefs

Task-number: QTCREATORBUG-170
This commit is contained in:
Roberto Raggi
2009-10-28 12:26:08 +01:00
parent aceeea9664
commit 345909a55a

View File

@@ -639,10 +639,19 @@ ResolveExpression::resolveBaseExpression(const QList<Result> &baseResults, int a
}
}
if (ty->isNamedType())
if (NamedType *namedTy = ty->asNamedType()) {
const QList<Scope *> visibleScopes = _context.visibleScopes(result);
const QList<Symbol *> typedefCandidates = _context.resolve(namedTy->name(), visibleScopes);
foreach (Symbol *typedefCandidate, typedefCandidates) {
if (typedefCandidate->isTypedef() && typedefCandidate->type()->isNamedType()) {
ty = typedefCandidate->type();
break;
}
}
results.append(Result(ty, lastVisibleSymbol));
else if (Function *fun = ty->asFunctionType()) {
} else if (Function *fun = ty->asFunctionType()) {
Scope *funScope = fun->scope();
if (funScope && (funScope->isBlockScope() || funScope->isNamespaceScope())) {