forked from qt-creator/qt-creator
CppEditor: No triggering for AssignToLocalVariable in return statements
With this patch it is checked if the function/new-expression is used in a function call or return statement the whole AST down to the translation unit. Task-number: QTCREATORBUG-9525 Change-Id: I34b30ee64b9436c9c9d2586c28fd22f148bee892 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
43e810759d
commit
af0582cdc9
@@ -4193,11 +4193,13 @@ void AssignToLocalVariable::match(const CppQuickFixInterface &interface, QuickFi
|
||||
return;
|
||||
if (path.at(idx)->asMemInitializer())
|
||||
return;
|
||||
if (path.at(i - 1)->asBinaryExpression())
|
||||
}
|
||||
for (int a = i - 1; a > 0; --a) {
|
||||
if (path.at(a)->asBinaryExpression())
|
||||
return;
|
||||
if (path.at(i - 1)->asReturnStatement())
|
||||
if (path.at(a)->asReturnStatement())
|
||||
return;
|
||||
if (path.at(i - 1)->asCall())
|
||||
if (path.at(a)->asCall())
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4231,11 +4233,14 @@ void AssignToLocalVariable::match(const CppQuickFixInterface &interface, QuickFi
|
||||
return;
|
||||
if (path.at(idx)->asMemInitializer())
|
||||
return;
|
||||
if (path.at(i - 1)->asReturnStatement())
|
||||
}
|
||||
for (int a = i - 1; a > 0; --a) {
|
||||
if (path.at(a)->asReturnStatement())
|
||||
return;
|
||||
if (path.at(i - 1)->asCall())
|
||||
if (path.at(a)->asCall())
|
||||
return;
|
||||
}
|
||||
|
||||
if (NamedTypeSpecifierAST *ts = path.at(i + 2)->asNamedTypeSpecifier()) {
|
||||
nameAST = ts->name->asSimpleName();
|
||||
visibleNameAST = nameAST;
|
||||
|
||||
Reference in New Issue
Block a user