JS: ignore useless-expr in first stmt in try block

This commit is contained in:
Asger Feldthaus
2020-01-14 11:17:54 +00:00
parent f7278d36e1
commit 6d9306366c
3 changed files with 31 additions and 1 deletions

View File

@@ -156,5 +156,7 @@ predicate hasNoEffect(Expr e) {
not exists(fe.getName())
) and
// exclude block-level flow type annotations. For example: `(name: empty)`.
not e.(ParExpr).getExpression().getLastToken().getNextToken().getValue() = ":"
not e.(ParExpr).getExpression().getLastToken().getNextToken().getValue() = ":" and
// exclude the first statement of a try block
not e = any(TryStmt stmt).getBody().getStmt(0).(ExprStmt).getExpr()
}