mirror of
https://github.com/github/codeql.git
synced 2026-04-22 23:35:14 +02:00
C#: Include normal switch/case statements in the white list and allow the use of wildcards when there is a condition.
This commit is contained in:
@@ -119,9 +119,14 @@ class ConstantMatchingCondition extends ConstantCondition {
|
||||
}
|
||||
|
||||
override predicate isWhiteListed() {
|
||||
exists(SwitchExpr se, int i |
|
||||
se.getCase(i).getPattern() = this.(DiscardExpr) and
|
||||
i > 0
|
||||
exists(Switch se, Case c, int i | c = se.getCase(i) |
|
||||
c.getPattern() = this.(DiscardExpr) and
|
||||
(
|
||||
i > 0
|
||||
or
|
||||
i = 0 and
|
||||
exists(Expr cond | c.getCondition() = cond and not isConstantCondition(cond, true))
|
||||
)
|
||||
)
|
||||
or
|
||||
this = any(PositionalPatternExpr ppe).getPattern(_)
|
||||
|
||||
Reference in New Issue
Block a user