mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
usesType: support pattern cases
This commit is contained in:
@@ -79,6 +79,11 @@ predicate depends(RefType t, RefType dep) {
|
||||
exists(InstanceOfExpr ioe | t = ioe.getEnclosingCallable().getDeclaringType() |
|
||||
usesType(ioe.getCheckedType(), dep)
|
||||
)
|
||||
or
|
||||
// the type accessed in a pattern-switch case statement in `t`.
|
||||
exists(PatternCase pc | t = pc.getEnclosingCallable().getDeclaringType() |
|
||||
usesType(pc.getDecl().getType(), dep)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,11 @@ predicate numDepends(RefType t, RefType dep, int value) {
|
||||
|
|
||||
usesType(ioe.getCheckedType(), dep)
|
||||
)
|
||||
or
|
||||
// the type accessed in a pattern-switch case statement in `t`.
|
||||
exists(PatternCase pc | elem = pc and t = pc.getEnclosingCallable().getDeclaringType() |
|
||||
usesType(pc.getDecl().getType(), dep)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user