File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
javascript/ql/src/Statements Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -73,16 +73,18 @@ predicate isConstantBooleanReturnValue(Expr e) {
7373 isConstantBooleanReturnValue ( e .( LogNotExpr ) .getOperand ( ) )
7474}
7575
76+ private Expr maybeStripLogNot ( Expr e ) {
77+ result = maybeStripLogNot ( e .( LogNotExpr ) .getOperand ( ) ) or
78+ result = e
79+ }
80+
7681/**
7782 * Holds if `e` is a defensive expression with a fixed outcome.
7883 */
7984predicate isConstantDefensive ( Expr e ) {
80- exists ( Expr defensive |
81- defensive = e or
82- // traverse negations
83- defensive .( LogNotExpr ) .getOperand + ( ) = e
84- |
85- exists ( defensive .flow ( ) .( DefensiveExpressionTest ) .getTheTestResult ( ) )
85+ exists ( DefensiveExpressionTest defensive |
86+ maybeStripLogNot ( defensive .asExpr ( ) ) = e and
87+ exists ( defensive .getTheTestResult ( ) )
8688 )
8789}
8890
You can’t perform that action at this time.
0 commit comments