Skip to content

Commit aef9445

Browse files
committed
Python learned flat-switch
1 parent 32f16d8 commit aef9445

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/control-flow/cfg-python.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,12 @@ export class CFGBuilder {
409409
this.addEdge(patternNode, consequenceBlock.entry, "consequence");
410410
if (consequenceBlock?.exit)
411411
this.addEdge(consequenceBlock.exit, mergeNode, "regular");
412-
if (previous) this.addEdge(previous, patternNode, "alternative");
413-
previous = patternNode;
412+
if (this.flatSwitch) {
413+
this.addEdge(previous, patternNode, "regular");
414+
} else {
415+
if (previous) this.addEdge(previous, patternNode, "alternative");
416+
previous = patternNode;
417+
}
414418
}
415419

416420
return blockHandler.update({ entry: subjectBlock.entry, exit: mergeNode });

0 commit comments

Comments
 (0)