Skip to content

Commit 15b1dae

Browse files
committed
JS: Added comment to explain exclusion of FunctionExpr
1 parent 1f256ab commit 15b1dae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

javascript/ql/lib/Expressions/ExprHasNoEffect.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ predicate isCompoundExpression(Expr e) {
140140
e instanceof SeqExpr
141141
or
142142
e instanceof ParExpr and
143+
// Parenthesized function expressions like `(function() {...})` should still be flagged
144+
// as useless when not invoked, so we exclude them
143145
not e.stripParens() instanceof FunctionExpr
144146
}
145147

0 commit comments

Comments
 (0)