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
@@ -2756,7 +2756,7 @@ void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noFunctionInFunction()
|
||||
}
|
||||
|
||||
/// Check: No trigger for functions in return statements (classes).
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnClass()
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnClass1()
|
||||
{
|
||||
const QByteArray original =
|
||||
"class Foo {public: static void fooFunc();}\n"
|
||||
@@ -2770,8 +2770,23 @@ void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnClass()
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
/// Check: No trigger for functions in return statements (classes). (QTCREATORBUG-9525)
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnClass2()
|
||||
{
|
||||
const QByteArray original =
|
||||
"class Foo {public: int fooFunc();}\n"
|
||||
"int bar() {\n"
|
||||
" return (new Fo@o)->fooFunc();\n"
|
||||
"}";
|
||||
const QByteArray expected = original + "\n";
|
||||
|
||||
AssignToLocalVariable factory;
|
||||
TestCase data(original, expected);
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
/// Check: No trigger for functions in return statements (functions).
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnFunc()
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnFunc1()
|
||||
{
|
||||
const QByteArray original =
|
||||
"class Foo {public: int fooFunc();}\n"
|
||||
@@ -2785,6 +2800,20 @@ void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnFunc()
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
/// Check: No trigger for functions in return statements (functions). (QTCREATORBUG-9525)
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnFunc2()
|
||||
{
|
||||
const QByteArray original =
|
||||
"int bar() {\n"
|
||||
" return list.firs@t().foo;\n"
|
||||
"}\n";
|
||||
const QByteArray expected = original + "\n";
|
||||
|
||||
AssignToLocalVariable factory;
|
||||
TestCase data(original, expected);
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
/// Check: No trigger for functions which does not match in signature.
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noSignatureMatch()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user