Community
Participate
Working Groups
In the following code, position the cursor on x and select Create local variable from the quick fix menu. void test() { x = 1; } The quick fix creates a declaration for x before the assignment statement: void test() { int x; x = 1; } It should instead produce: void test() { int x = 1; }
Created attachment 198017 [details] fix This implements the feature for simple assignments. One might notice that currently part of the generated declaration lands in the wrong place (the declspec is added line or a few lines before the initializer). I suspect this is another problem with ASTRewrite infrastructure.
can you please create a unit test too?
Created attachment 199868 [details] fix + tests The problem is that the issue with ASTRewrite I've mentioned (wrong output formatting) breaks the tests after this patch.
(In reply to comment #3) > The problem is that the issue with ASTRewrite I've mentioned (wrong output > formatting) breaks the tests after this patch. The issues with ASTRewrite, invalid edits and lack of formatting, affect all refactorings. These issues should be solved independently from this bug. Tomassz, you can modify the test to make it pass as long as the only difference is wrong formatting.
Created attachment 199933 [details] fix + tests OK, let's have it this way! New patch. BTW- switched to command line from EGit, I hope I made the patch right :)
Tomasz, could you submit this patch to Gerrit so it can be committed? Thanks!