Skip to content

Commit

Permalink
[Enhanced Switch] "Retrofit" some design into code generation for switch
Browse files Browse the repository at this point in the history
statement

* Fixes #3430
  • Loading branch information
srikanth-sankaran committed Dec 13, 2024
1 parent 87c856f commit e954972
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class CaseStatement extends Statement {

public BranchLabel targetLabel;
public Expression[] constantExpressions; // case with multiple expressions - if you want a under-the-hood view, use peeledLabelExpressions()
public BranchLabel[] targetLabels; // for multiple expressions
public boolean isSwitchRule = false;

public SwitchStatement swich; // owning switch
Expand Down Expand Up @@ -324,13 +323,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
public void generateCode(BlockScope currentScope, CodeStream codeStream) {
if ((this.bits & ASTNode.IsReachable) == 0)
return;

int pc = codeStream.position;
if (this.targetLabels != null) {
for (BranchLabel label : this.targetLabels)
label.place();
}
if (this.targetLabel != null)
this.targetLabel.place();
this.targetLabel.place();

if (containsPatternVariable(true)) {

Expand Down
Loading

0 comments on commit e954972

Please sign in to comment.