Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cdde8ae

Browse files
committed
revert changes to js/useless-expression
1 parent be18adc commit cdde8ae

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

javascript/ql/src/Expressions/ExprHasNoEffect.qll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ predicate inVoidContext(Expr e) {
2828
i < n - 1 or inVoidContext(seq)
2929
)
3030
or
31-
exists(ParExpr par | par.getExpression() = e and inVoidContext(par) )
32-
or
3331
exists(ForStmt stmt | e = stmt.getUpdate())
3432
or
3533
exists(ForStmt stmt | e = stmt.getInit() |
@@ -38,8 +36,4 @@ predicate inVoidContext(Expr e) {
3836
)
3937
or
4038
exists(LogicalBinaryExpr logical | e = logical.getRightOperand() and inVoidContext(logical))
41-
or
42-
exists(TypeAssertion assert | assert.getExpression() = e and inVoidContext(assert))
43-
or
44-
exists(UnaryExpr unOp | unOp.getOperator() = "void" and unOp.getOperand() = e)
4539
}

javascript/ql/src/Statements/UseOfReturnlessFunction.ql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ predicate benignContext(Expr e) {
4242
exists(SeqExpr parent | parent.getAnOperand() = e and benignContext(parent))
4343
or
4444
exists(ParExpr par | par.getExpression() = e and benignContext(par))
45+
or
46+
exists(TypeAssertion assert | assert.getExpression() = e and inVoidContext(assert))
47+
or
48+
exists(UnaryExpr unOp | unOp.getOperator() = "void" and unOp.getOperand() = e)
4549
or
4650

4751
// It is ok (or to be flagged by another query?) to await a non-async function.

0 commit comments

Comments
 (0)