forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtst.js
More file actions
87 lines (66 loc) · 1.74 KB
/
tst.js
File metadata and controls
87 lines (66 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
'use strict';
'use struct'; // OK - flagged by UnknownDirective.ql
23; // $ Alert
void(23);
23, foo(); // $ Alert
foo(23, 42);
foo((23, bar())); // $ Alert
foo((bar(), 23));
1,f(); // $ Alert
/**
* @type {function(int) : string}
*/
String.prototype.slice;
/** @typedef {(string|number)} */
goog.NumberLike;
/** Useless */
x; // $ Alert
// OK - magic DOM property
elt.clientTop;
// OK - xUnit fixture
[Fixture]
function tst() {}
// OK - bad style, but most likely intentional
(0, o.m)();
(0, o["m"])();
function tst() {
// OK - bad style, but most likely intentional
(0, eval)("42");
}
function f() {
var x;
"foo"; // $ Alert
}
try {
doSomethingDangerous();
} catch(e) {
new Error("Told you so"); // $ Alert
new SyntaxError("Why didn't you listen to me?"); // $ Alert
new Error(computeSnarkyMessage(e)); // $ Alert
new UnknownError();
}
function g() {
var o = {};
Object.defineProperty(o, "trivialGetter1", { get: function(){} });
o.trivialGetter1;
Object.defineProperty(o, "trivialNonGetter1", "foo");
o.trivialNonGetter1; // $ Alert
var getterDef1 = { get: function(){} };
Object.defineProperty(o, "nonTrivialGetter1", getterDef1);
o.nonTrivialGetter1;
var getterDef2 = { };
unknownPrepareGetter(getterDef2);
Object.defineProperty(o, "nonTrivialNonGetter1", getterDef2);
o.nonTrivialNonGetter1;
Object.defineProperty(o, "nonTrivialGetter2", unknownGetterDef());
o.nonTrivialGetter2;
(o: empty);
testSomeCondition() ? o : // $ Alert
doSomethingDangerous();
consume(testSomeCondition() ? o :
doSomethingDangerous());
("release" === isRelease() ? warning() : null);
"release" === isRelease() ? warning() : null;
"release" === isRelease() ? warning() : 0;
"release" === isRelease() ? warning() : undefined;
};