forked from qt-creator/qt-creator
CPlusPlus: Improve type name minimization
... for function parameters. These are located in the scope of the surrounding class or namespace. This uncovered a bug in the "Insert Virtual Functions of Base Classes" quickfix, which we also fix here. Fixes: QTCREATORBUG-8030 Change-Id: I7f11659dc8e252e3819df8178734e8958fa1b496 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -142,6 +142,17 @@ public:
|
||||
|
||||
funTy->setReturnType(rewrite->rewriteType(type->returnType()));
|
||||
|
||||
// Function parameters have the function's enclosing scope.
|
||||
Scope *scope = nullptr;
|
||||
ClassOrNamespace *target = nullptr;
|
||||
if (rewrite->env->context().bindings())
|
||||
target = rewrite->env->context().lookupType(type->enclosingScope());
|
||||
UseMinimalNames useMinimalNames(target);
|
||||
if (target) {
|
||||
scope = rewrite->env->switchScope(type->enclosingScope());
|
||||
rewrite->env->enter(&useMinimalNames);
|
||||
}
|
||||
|
||||
for (unsigned i = 0, argc = type->argumentCount(); i < argc; ++i) {
|
||||
Symbol *arg = type->argumentAt(i);
|
||||
|
||||
@@ -156,6 +167,11 @@ public:
|
||||
funTy->addMember(newArg);
|
||||
}
|
||||
|
||||
if (target) {
|
||||
rewrite->env->switchScope(scope);
|
||||
rewrite->env->leave();
|
||||
}
|
||||
|
||||
temps.append(funTy);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user