Cfg: Rework CFG for switch case patterns.

This commit is contained in:
Anders Schack-Mulligen
2026-05-07 13:07:07 +02:00
parent b67ebd11e0
commit 48785a0a76
3 changed files with 50 additions and 49 deletions

View File

@@ -153,10 +153,10 @@ private module Ast implements AstSig<Location> {
}
class Case extends AstNode instanceof J::SwitchCase {
/** Gets a pattern being matched by this case. */
AstNode getAPattern() {
result = this.(PatternCase).getAPattern() or
result = this.(ConstCase).getValue(_)
/** Gets the pattern being matched by this case at the specified (zero-based) `index`. */
AstNode getPattern(int index) {
result = this.(PatternCase).getPattern(index) or
result = this.(ConstCase).getValue(index)
}
/** Gets the guard expression of this case, if any. */