mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
JS: Enhance void context propagation
This commit is contained in:
@@ -22,6 +22,9 @@ predicate inVoidContext(Expr e) {
|
||||
)
|
||||
)
|
||||
or
|
||||
// propagate void context through parenthesized expressions
|
||||
inVoidContext(e.getParent().(ParExpr))
|
||||
or
|
||||
exists(SeqExpr seq, int i, int n |
|
||||
e = seq.getOperand(i) and
|
||||
n = seq.getNumOperands()
|
||||
|
||||
@@ -11,4 +11,6 @@
|
||||
| tst.js:49:3:49:49 | new Syn ... o me?") | This expression has no effect. |
|
||||
| tst.js:50:3:50:36 | new Err ... age(e)) | This expression has no effect. |
|
||||
| tst.js:61:2:61:20 | o.trivialNonGetter1 | This expression has no effect. |
|
||||
| tst.js:75:3:75:3 | o | This expression has no effect. |
|
||||
| tst.js:77:24:77:24 | o | This expression has no effect. |
|
||||
| uselessfn.js:1:2:1:26 | functio ... d.");\\n} | This expression has no effect. |
|
||||
|
||||
@@ -72,7 +72,7 @@ function g() {
|
||||
Object.defineProperty(o, "nonTrivialGetter2", unknownGetterDef());
|
||||
o.nonTrivialGetter2;
|
||||
|
||||
(o: empty);
|
||||
(o: empty); // $SPURIOUS:Alert
|
||||
|
||||
testSomeCondition() ? o : // $ Alert
|
||||
doSomethingDangerous();
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
(function f() { // $MISSING: Alert
|
||||
(function f() { // $ Alert
|
||||
console.log("I'm never called.");
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user