C++: Fix completion for namespace aliases at global or namespace scope.

Task-number: QTCREATORBUG-166
Change-Id: Ic0fe4067caad37e51f7e253fd6678a6680350870
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Christian Kamm
2011-11-22 10:51:54 +01:00
parent eaf4b5be53
commit 2f58fb95bc

View File

@@ -518,6 +518,14 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
item.setDeclaration(s);
item.setBinding(binding);
if (s->asNamespaceAlias() && binding) {
ClassOrNamespace *targetNamespaceBinding = binding->lookupType(name);
if (targetNamespaceBinding && targetNamespaceBinding->symbols().size() == 1) {
Symbol *resolvedSymbol = targetNamespaceBinding->symbols().first();
item.setType(resolvedSymbol->type()); // override the type
}
}
if (templateId && (s->isDeclaration() || s->isFunction())) {
FullySpecifiedType ty = DeprecatedGenTemplateInstance::instantiate(templateId, s, _control);
item.setType(ty); // override the type.