We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33f4503 commit cee986fCopy full SHA for cee986f
javascript/ql/src/Expressions/ExprHasNoEffect.qll
@@ -158,5 +158,7 @@ predicate hasNoEffect(Expr e) {
158
// exclude block-level flow type annotations. For example: `(name: empty)`.
159
not e.(ParExpr).getExpression().getLastToken().getNextToken().getValue() = ":" and
160
// exclude the first statement of a try block
161
- not e = any(TryStmt stmt).getBody().getStmt(0).(ExprStmt).getExpr()
+ not e = any(TryStmt stmt).getBody().getStmt(0).(ExprStmt).getExpr() and
162
+ // exclude expressions that are alone in a file
163
+ not e.getParent().(ExprStmt).getParent().(TopLevel).getNumChild() = 1
164
}
0 commit comments