mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ControlFlowAnalyzer: do not generate jump out of switch rule if body cannot complete normally
This commit is contained in:
+7
-6
@@ -849,12 +849,13 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
boolean expressionSwitch = myExpressionBlockContext != null && myExpressionBlockContext.myCodeBlock == switchBody;
|
||||
if (expressionSwitch && body instanceof PsiExpressionStatement) {
|
||||
myExpressionBlockContext.generateReturn(((PsiExpressionStatement)body).getExpression(), this);
|
||||
}
|
||||
if (body != null) {
|
||||
body.accept(this);
|
||||
}
|
||||
if (!(body instanceof PsiThrowStatement)) {
|
||||
jumpOut(expressionSwitch ? switchBody : switchBlock);
|
||||
} else {
|
||||
if (body != null) {
|
||||
body.accept(this);
|
||||
}
|
||||
if (ControlFlowUtils.statementMayCompleteNormally(body)) {
|
||||
jumpOut(expressionSwitch ? switchBody : switchBlock);
|
||||
}
|
||||
}
|
||||
finishElement(statement);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user