Skip to content

Commit 06d5233

Browse files
committed
Use SwitchCase.getSelectorExpr
1 parent b731b8d commit 06d5233

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

java/ql/lib/semmle/code/java/controlflow/Guards.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ class Guard extends ExprParent {
108108
*/
109109
BasicBlock getBasicBlock() {
110110
result = this.(Expr).getBasicBlock() or
111-
result = this.(SwitchCase).getSwitch().getExpr().getBasicBlock() or
112-
result = this.(SwitchCase).getSwitchExpr().getExpr().getBasicBlock()
111+
result = this.(SwitchCase).getSelectorExpr().getBasicBlock()
113112
}
114113

115114
/**

java/ql/lib/semmle/code/java/dataflow/TypeFlow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ private predicate instanceOfGuarded(Expr e, RefType t) {
445445
*/
446446
private predicate patternCaseGuarded(Expr e, RefType t) {
447447
exists(PatternCase pc |
448-
e = getAProbableAlias([pc.getSwitch().getExpr(), pc.getSwitchExpr().getExpr()]) and
448+
e = getAProbableAlias(pc.getSelectorExpr()) and
449449
guardControls_v1(pc, e.getBasicBlock(), true) and
450450
t = pc.getPattern().getType()
451451
)

0 commit comments

Comments
 (0)