File tree Expand file tree Collapse file tree
javascript/ql/src/Statements Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,11 +85,11 @@ predicate alwaysThrows(Function f) {
8585/**
8686 * Holds if the last statement in the function is flagged by the js/useless-expression query.
8787 */
88- predicate alwaysHasNoEffect ( Function f ) {
89- exists ( ReachableBasicBlock entry , DataFlow:: Node noEffect |
90- entry = f . getEntryBB ( ) and
91- hasNoEffect ( noEffect .asExpr ( ) ) and
92- entry . dominates ( noEffect .getBasicBlock ( ) )
88+ predicate lastStatementHasNoEffect ( Function f ) {
89+ exists ( DataFlow:: Node noEffect |
90+ noEffect . getContainer ( ) = f and
91+ hasNoEffect ( noEffect .asExpr ( ) ) and
92+ not exists ( noEffect .getASuccessor ( ) )
9393 )
9494}
9595
@@ -155,7 +155,7 @@ where
155155 name = "callback function"
156156 ) and
157157 not benignContext ( call .asExpr ( ) ) and
158- not alwaysHasNoEffect ( func ) and
158+ not lastStatementHasNoEffect ( func ) and
159159 // anonymous one-shot closure. Those are used in weird ways and we ignore them.
160160 not oneshotClosure ( call .asExpr ( ) )
161161select
You can’t perform that action at this time.
0 commit comments