Use SwitchCase.getSelectorExpr

This commit is contained in:
Chris Smowton
2023-11-15 16:04:41 +00:00
parent b731b8d30a
commit 06d5233523
2 changed files with 2 additions and 3 deletions

View File

@@ -108,8 +108,7 @@ class Guard extends ExprParent {
*/
BasicBlock getBasicBlock() {
result = this.(Expr).getBasicBlock() or
result = this.(SwitchCase).getSwitch().getExpr().getBasicBlock() or
result = this.(SwitchCase).getSwitchExpr().getExpr().getBasicBlock()
result = this.(SwitchCase).getSelectorExpr().getBasicBlock()
}
/**

View File

@@ -445,7 +445,7 @@ private predicate instanceOfGuarded(Expr e, RefType t) {
*/
private predicate patternCaseGuarded(Expr e, RefType t) {
exists(PatternCase pc |
e = getAProbableAlias([pc.getSwitch().getExpr(), pc.getSwitchExpr().getExpr()]) and
e = getAProbableAlias(pc.getSelectorExpr()) and
guardControls_v1(pc, e.getBasicBlock(), true) and
t = pc.getPattern().getType()
)