Skip to content

Commit 5e375f8

Browse files
committed
JS: Accept some UselessConditional alerts
1 parent 6840384 commit 5e375f8

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

javascript/ql/test/query-tests/Statements/UselessConditional/UselessConditional.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ function getLastLine(input) {
22
var lines = [], nextLine;
33
while ((nextLine = readNextLine(input)))
44
lines.push(nextLine);
5-
if (!lines)
5+
if (!lines) // $ Alert
66
throw new Error("No lines!");
77
return lines[lines.length-1];
88
}
99

1010
function lookup(cache, k) {
1111
var v;
12-
return k in cache ? cache[k] : (v = new Entry(recompute())) && (cache[k] = v);
12+
return k in cache ? cache[k] : (v = new Entry(recompute())) && (cache[k] = v); // $ Alert
1313
}
1414

1515
function test(a, b) {
1616
if (!a && !b) {
17-
if (a);
18-
if (b);
17+
if (a); // $ Alert
18+
if (b); // $ Alert
1919
}
2020
if (!(a || b)) {
21-
if (a);
22-
if (b);
21+
if (a); // $ Alert
22+
if (b); // $ Alert
2323
}
2424

2525
var x = new X();
26-
if(x){}
27-
if (new X()){}
28-
if((x)){}
29-
if(((x))){}
30-
if ((new X())){}
26+
if(x){} // $ Alert
27+
if (new X()){} // $ Alert
28+
if((x)){} // $ Alert
29+
if(((x))){} // $ Alert
30+
if ((new X())){} // $ Alert
3131

3232
x = 0n;
3333
if (x) // $ Alert
@@ -51,7 +51,7 @@ async function awaitFlow(){
5151
var known = knownF();
5252
if (known)
5353
return;
54-
if (known)
54+
if (known) // $ Alert
5555
return;
5656

5757
var unknown = unknownF();
@@ -86,7 +86,7 @@ async function awaitFlow(){
8686
});
8787

8888
(function() {
89-
if ((x, true));
89+
if ((x, true)); // $ Alert
9090
});
9191

9292
(function (x, y) {

0 commit comments

Comments
 (0)