mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-182501 Unwrap 'if' generates unreachable code
This commit is contained in:
@@ -421,7 +421,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
instruction = new ReturnInstruction(0, myStack, callInstruction);
|
||||
}
|
||||
else {
|
||||
instruction = new GoToInstruction(0);
|
||||
instruction = new GoToInstruction(0, BranchingInstruction.Role.END, PsiTreeUtil.isAncestor(exitedStatement, myCodeFragment, true));
|
||||
}
|
||||
myCurrentFlow.addInstruction(instruction);
|
||||
// exited statement might be out of control flow analyzed
|
||||
@@ -483,7 +483,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
instruction = new ReturnInstruction(0, myStack, callInstruction);
|
||||
}
|
||||
else {
|
||||
instruction = new GoToInstruction(0);
|
||||
instruction = new GoToInstruction(0, BranchingInstruction.Role.END, PsiTreeUtil.isAncestor(body, myCodeFragment, true));
|
||||
}
|
||||
myCurrentFlow.addInstruction(instruction);
|
||||
addElementOffsetLater(body, false);
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
class X {
|
||||
void f(){
|
||||
while (true) {
|
||||
continue;//comment
|
||||
}
|
||||
}}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
class X {
|
||||
void f(){
|
||||
while (true) {
|
||||
if (tr<caret>ue) {
|
||||
continue;//comment
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}}
|
||||
@@ -7,5 +7,5 @@
|
||||
6: COND_THROW_TO 8
|
||||
7: GOTO [END] 11
|
||||
8: WRITE e
|
||||
9: GOTO [END] 11
|
||||
9: GOTO [END] 11 RETURN
|
||||
10: GOTO [END] 11
|
||||
Reference in New Issue
Block a user