KT-879 Translate witches, wizards, gnomes correctly, also don't forget about switch statement
This commit is contained in:
@@ -17,7 +17,7 @@ public class CaseContainer extends Statement {
|
||||
myCaseStatement = caseStatement;
|
||||
List<Statement> newStatements = new LinkedList<Statement>();
|
||||
for (Statement s : statements)
|
||||
if (s.getKind() != Kind.BREAK && s.getKind() != Kind.CONTINUE )
|
||||
if (s.getKind() != Kind.BREAK && s.getKind() != Kind.CONTINUE)
|
||||
newStatements.add(s);
|
||||
myBlock = new Block(newStatements);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ public class StatementVisitor extends ElementVisitor {
|
||||
List<PsiStatement> result = new LinkedList<PsiStatement>();
|
||||
for (int i = start; i < allStatements.size(); i++) {
|
||||
PsiStatement s = allStatements.get(i);
|
||||
if (s instanceof PsiBreakStatement)
|
||||
if (s instanceof PsiBreakStatement || s instanceof PsiReturnStatement)
|
||||
return result;
|
||||
if (!(s instanceof PsiSwitchLabelStatement))
|
||||
result.add(s);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
public static int getInt(int i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 3:
|
||||
return 3;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
open class Test() {
|
||||
class object {
|
||||
open public fun getInt(i : Int) : Int {
|
||||
when (i) {
|
||||
0 -> {
|
||||
return 0
|
||||
}
|
||||
1 -> {
|
||||
return 1
|
||||
}
|
||||
2 -> {
|
||||
return 2
|
||||
}
|
||||
3 -> {
|
||||
return 3
|
||||
}
|
||||
else -> {
|
||||
return (-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user