mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
JS: minor fixup: only traverse LogNotExprs
This commit is contained in:
@@ -73,16 +73,18 @@ predicate isConstantBooleanReturnValue(Expr e) {
|
||||
isConstantBooleanReturnValue(e.(LogNotExpr).getOperand())
|
||||
}
|
||||
|
||||
private Expr maybeStripLogNot(Expr e) {
|
||||
result = maybeStripLogNot(e.(LogNotExpr).getOperand()) or
|
||||
result = e
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `e` is a defensive expression with a fixed outcome.
|
||||
*/
|
||||
predicate isConstantDefensive(Expr e) {
|
||||
exists(Expr defensive |
|
||||
defensive = e or
|
||||
// traverse negations
|
||||
defensive.(LogNotExpr).getOperand+() = e
|
||||
|
|
||||
exists(defensive.flow().(DefensiveExpressionTest).getTheTestResult())
|
||||
exists(DefensiveExpressionTest defensive |
|
||||
maybeStripLogNot(defensive.asExpr()) = e and
|
||||
exists(defensive.getTheTestResult())
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user