mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: Restored folding of nested function calls when extracting method (IDEA-175221, IDEA-167255)
This commit is contained in:
+1
-1
@@ -245,7 +245,7 @@ public class ParametersFolder {
|
||||
if (!isMethodNameExpression(expression)) {
|
||||
expressions.add((PsiExpression)expression);
|
||||
}
|
||||
expression = parent instanceof PsiExpression ? parent : null;
|
||||
expression = PsiTreeUtil.getParentOfType(expression, PsiExpression.class);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.List;
|
||||
class C {
|
||||
void foo(int[] a, List<Integer> b) {
|
||||
int i = 1;
|
||||
int n = <selection>bar(a[i], b.get(i))</selection>;
|
||||
System.out.println(n);
|
||||
}
|
||||
|
||||
int bar(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.util.List;
|
||||
class C {
|
||||
void foo(int[] a, List<Integer> b) {
|
||||
int i = 1;
|
||||
int n = newMethod(bar(a[i], b.get(i)));
|
||||
System.out.println(n);
|
||||
}
|
||||
|
||||
private int newMethod(int bar) {
|
||||
return bar;
|
||||
}
|
||||
|
||||
int bar(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
@@ -448,6 +448,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFoldingWithFunctionCall() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDontSkipVariablesUsedInLeftSideOfAssignments() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user