JS: Update OK-style comments to $-style

This commit is contained in:
Asger F
2025-02-06 13:34:01 +01:00
parent 7e5c24a8ec
commit 9be041e27d
536 changed files with 4408 additions and 4762 deletions

View File

@@ -2,26 +2,23 @@ var x;
function f(a) {
var sum = 0;
// NOT OK
for (i=0; i<a.length; ++i)
for (i=0; i<a.length; ++i) // $ Alert
sum += g(a[i]);
return sum;
}
function g(b) {
var prod = 1;
// NOT OK
for (i=0; i<b.length; ++i)
for (i=0; i<b.length; ++i) // $ Alert
prod *= b[i];
return prod;
}
function h() {
// OK: x is declared as a global in the same toplevel
// OK - x is declared as a global in the same toplevel
x = 23;
// NOT OK: y is not declared as a global in the same toplevel (though it is declared in test2.js)
y = 19;
// OK: console is live
y = 19; // $ Alert - y is not declared as a global in the same toplevel (though it is declared in test2.js)
// OK - console is live
console.log(x+y);
}
@@ -29,41 +26,38 @@ function k(x) {
try {
return x.y;
} catch(e) {
// OK: Error is not reachable (in our current CFG)
// OK - Error is not reachable (in our current CFG)
throw new Error();
}
}
function l() {
// OK: z is not used
// OK - z is not used
z = 56;
}
function m() {
// OK: z is live
// OK - z is live
z += 23;
}
function n() {
// OK: z is live
// OK - z is live
z = z + 23;
}
function p() {
// NOT OK
return (z = a[i]) && z+23;
return (z = a[i]) && z+23; // $ Alert
}
function q() {
// NOT OK
var x;
var x; // $ Alert
y = 23,
z = y+19;
}
function r() {
// NOT OK
z = {};
z = {}; // $ Alert
for (var p in z)
;
}