Eliminate duplicate predicate

This commit is contained in:
Chris Smowton
2023-11-27 14:04:17 +00:00
parent 3971817c92
commit 40464ed1f9

View File

@@ -2,19 +2,12 @@
import java
/**
* Gets the `i`th `SwitchCase` defined on `switch`, if one exists.
*/
SwitchCase getCase(StmtParent switch, int i) {
result = switch.(SwitchExpr).getCase(i) or result = switch.(SwitchStmt).getCase(i)
}
/**
* Gets the `i`th `PatternCase` defined on `switch`, if one exists.
*/
PatternCase getPatternCase(StmtParent switch, int i) {
result =
rank[i + 1](PatternCase pc, int caseIdx | pc = getCase(switch, caseIdx) | pc order by caseIdx)
rank[i + 1](PatternCase pc, int caseIdx | pc.isNthCaseOf(switch, caseIdx) | pc order by caseIdx)
}
/**