CppEditor: Do not show InsertDefFromDecl if triggered on a statement

Change-Id: Ib0b110ac80d9519461a6ba6cf5b7c77925ed2ea5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Lorenz Haas
2013-05-24 10:32:50 +02:00
committed by Nikolai Kosjar
parent e1db88e113
commit 20a23ec72b
3 changed files with 21 additions and 0 deletions

View File

@@ -2609,6 +2609,8 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
for (; idx >= 0; --idx) {
AST *node = path.at(idx);
if (SimpleDeclarationAST *simpleDecl = node->asSimpleDeclaration()) {
if (idx > 0 && path.at(idx - 1)->asStatement())
return;
if (simpleDecl->symbols && ! simpleDecl->symbols->next) {
if (Symbol *symbol = simpleDecl->symbols->value) {
if (Declaration *decl = symbol->asDeclaration()) {