mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
revert changes to js/useless-expression
This commit is contained in:
@@ -28,8 +28,6 @@ predicate inVoidContext(Expr e) {
|
||||
i < n - 1 or inVoidContext(seq)
|
||||
)
|
||||
or
|
||||
exists(ParExpr par | par.getExpression() = e and inVoidContext(par) )
|
||||
or
|
||||
exists(ForStmt stmt | e = stmt.getUpdate())
|
||||
or
|
||||
exists(ForStmt stmt | e = stmt.getInit() |
|
||||
@@ -38,8 +36,4 @@ predicate inVoidContext(Expr e) {
|
||||
)
|
||||
or
|
||||
exists(LogicalBinaryExpr logical | e = logical.getRightOperand() and inVoidContext(logical))
|
||||
or
|
||||
exists(TypeAssertion assert | assert.getExpression() = e and inVoidContext(assert))
|
||||
or
|
||||
exists(UnaryExpr unOp | unOp.getOperator() = "void" and unOp.getOperand() = e)
|
||||
}
|
||||
|
||||
@@ -42,6 +42,10 @@ predicate benignContext(Expr e) {
|
||||
exists(SeqExpr parent | parent.getAnOperand() = e and benignContext(parent))
|
||||
or
|
||||
exists(ParExpr par | par.getExpression() = e and benignContext(par))
|
||||
or
|
||||
exists(TypeAssertion assert | assert.getExpression() = e and inVoidContext(assert))
|
||||
or
|
||||
exists(UnaryExpr unOp | unOp.getOperator() = "void" and unOp.getOperand() = e)
|
||||
or
|
||||
|
||||
// It is ok (or to be flagged by another query?) to await a non-async function.
|
||||
|
||||
Reference in New Issue
Block a user