Improve complexity class of getASuccessorSwitchCase

This commit is contained in:
Chris Smowton
2023-11-22 19:37:34 +00:00
parent d99a005b42
commit 1047a89613
2 changed files with 24 additions and 6 deletions

View File

@@ -464,6 +464,14 @@ class SwitchCase extends Stmt, @case {
this = any(SwitchStmt ss).getCase(result) or this = any(SwitchExpr se).getCase(result)
}
/**
* Holds if this is the `n`th case of switch block `parent`.
*/
pragma[nomagic]
predicate isNthCaseOf(StmtParent parent, int n) {
this.getCaseIndex() = n and this.getParent() = parent
}
/**
* Holds if this `case` is a switch labeled rule of the form `... -> ...`.
*/