mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
DfaAssist: fix analysis of switch expressions (EA-221783)
GitOrigin-RevId: a721cc9c54ec3487ed87049b4f6fddb7021848a0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b23971256e
commit
90a58ee75c
@@ -391,8 +391,16 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
public void visitYieldStatement(PsiYieldStatement statement) {
|
||||
startElement(statement);
|
||||
PsiSwitchExpression enclosing = statement.findEnclosingExpression();
|
||||
PsiExpression expression = statement.getExpression();
|
||||
if (enclosing != null && myExpressionBlockContext != null && myExpressionBlockContext.myCodeBlock == enclosing.getBody()) {
|
||||
myExpressionBlockContext.generateReturn(statement.getExpression(), this);
|
||||
myExpressionBlockContext.generateReturn(expression, this);
|
||||
} else {
|
||||
// yield in incorrect location or only part of switch is analyzed
|
||||
if (expression != null) {
|
||||
expression.accept(this);
|
||||
addInstruction(new PopInstruction());
|
||||
}
|
||||
jumpOut(enclosing);
|
||||
}
|
||||
finishElement(statement);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user