From 077f5039587e52fa924ebebafb8032852521dbe9 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Mon, 15 Aug 2011 13:02:51 +0200 Subject: [PATCH] C++: Use minimal names in 'insert local declaration' quickfix. Change-Id: Ia8362bc9a4b319ab4bb65f3fb1a36dc769e28ccd Reviewed-on: http://codereview.qt.nokia.com/2953 Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com> --- src/plugins/cppeditor/cppquickfixes.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 1f764167551..f5f5b82d5ee 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -1536,8 +1536,9 @@ private: TypeOfExpression typeOfExpression; typeOfExpression.init(assistInterface()->semanticInfo().doc, assistInterface()->snapshot(), assistInterface()->context().bindings()); + Scope *scope = currentFile->scopeAt(binaryAST->firstToken()); const QList<LookupItem> result = typeOfExpression(currentFile->textOf(binaryAST->right_expression), - currentFile->scopeAt(binaryAST->firstToken()), + scope, TypeOfExpression::Preprocess); if (! result.isEmpty()) { @@ -1545,7 +1546,10 @@ private: SubstitutionEnvironment env; env.setContext(assistInterface()->context()); env.switchScope(result.first().scope()); - UseQualifiedNames q; + ClassOrNamespace *con = typeOfExpression.context().lookupType(scope); + if (!con) + con = typeOfExpression.context().globalNamespace(); + UseMinimalNames q(con); env.enter(&q); Control *control = assistInterface()->context().control().data(); -- GitLab