mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
29 lines
482 B
JavaScript
29 lines
482 B
JavaScript
// NOT OK
|
|
(0).foo = 42;
|
|
|
|
// NOT OK, but already flagged by SuspiciousPropAccess.ql
|
|
null.bar = 23; undefined.baz = 42;
|
|
|
|
function f() {
|
|
var s = "";
|
|
for (var i=0;i<10;++i)
|
|
// NOT OK
|
|
s[i] = " ";
|
|
}
|
|
|
|
function g(b) {
|
|
var x = b ? "" : 42, z;
|
|
// NOT OK
|
|
x.y = true;
|
|
// OK: we don't know the type of `b`
|
|
b.y = true;
|
|
return;
|
|
// OK: no types inferred for `z`, since this is dead code
|
|
z.y = true;
|
|
}
|
|
|
|
function h() {
|
|
let tmp;
|
|
let obj = (tmp ||= {});
|
|
obj.p = 42;
|
|
} |