mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
stop folding before statement is reached (IDEA-51711)
This commit is contained in:
@@ -193,7 +193,7 @@ public class ParametersFolder {
|
||||
if (expression == null) break;
|
||||
|
||||
final PsiType expressionType = ((PsiExpression)expression).getType();
|
||||
if (expressionType != null && expressionType != PsiType.VOID) {
|
||||
if (expressionType != null && expressionType != PsiType.VOID && !(expression.getParent() instanceof PsiExpressionStatement)) {
|
||||
expressions.add((PsiExpression)expression);
|
||||
}
|
||||
expression = PsiTreeUtil.getParentOfType(expression, PsiExpression.class);
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
class A {
|
||||
public static void main(String[] args) {
|
||||
StatDescriptor[] allStatMembers = new StatDescriptor[] {};
|
||||
WSStats[] allStats = new WSStats[] {};
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("All stat members found:\n");
|
||||
for (int i = 0; i < allStatMembers.length; i++) {
|
||||
StatDescriptor statMember = allStatMembers[i];
|
||||
|
||||
<selection>
|
||||
sb.append(statMember.toString());
|
||||
|
||||
sb.append(": [");
|
||||
|
||||
WSStatistic[] statistics = allStats[i].getStatistics();
|
||||
for (int j = 0; j < statistics.length; j++) {
|
||||
WSStatistic statistic = statistics[j];
|
||||
sb.append(statistic.getId()).
|
||||
append('=').
|
||||
append(statistic.getName());
|
||||
if (j < statistics.length - 1) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("]\n");
|
||||
</selection>
|
||||
}
|
||||
}
|
||||
|
||||
private class StatDescriptor {
|
||||
}
|
||||
|
||||
private class WSStatistic {
|
||||
private Object id;
|
||||
private String name;
|
||||
|
||||
public Object getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private class WSStats {
|
||||
private WSStatistic[] statistics;
|
||||
|
||||
public WSStatistic[] getStatistics() {
|
||||
return statistics;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
class A {
|
||||
public static void main(String[] args) {
|
||||
StatDescriptor[] allStatMembers = new StatDescriptor[] {};
|
||||
WSStats[] allStats = new WSStats[] {};
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("All stat members found:\n");
|
||||
for (int i = 0; i < allStatMembers.length; i++) {
|
||||
StatDescriptor statMember = allStatMembers[i];
|
||||
|
||||
|
||||
newMethod(allStats[i], sb, statMember);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void newMethod(WSStats allStat, StringBuffer sb, StatDescriptor statMember) {
|
||||
sb.append(statMember.toString());
|
||||
|
||||
sb.append(": [");
|
||||
|
||||
WSStatistic[] statistics = allStat.getStatistics();
|
||||
for (int j = 0; j < statistics.length; j++) {
|
||||
WSStatistic statistic = statistics[j];
|
||||
sb.append(statistic.getId()).
|
||||
append('=').
|
||||
append(statistic.getName());
|
||||
if (j < statistics.length - 1) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("]\n");
|
||||
}
|
||||
|
||||
private class StatDescriptor {
|
||||
}
|
||||
|
||||
private class WSStatistic {
|
||||
private Object id;
|
||||
private String name;
|
||||
|
||||
public Object getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private class WSStats {
|
||||
private WSStatistic[] statistics;
|
||||
|
||||
public WSStatistic[] getStatistics() {
|
||||
return statistics;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,6 +286,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStopFolding() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEADEV11748() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user