blob: f3526f9bab019f69cbc0c2ddb33f12d039e126a8 [file] [log] [blame]
saambarati1@gmail.com06e39132015-07-31 21:05:19 +00001function assert(b) {
2 if (!b)
3 throw new Error("Assertion failure");
4}
5noInline(assert);
6
7function truth() { return true; }
8noInline(truth);
9
10const NUM_LOOPS = 1000;
11
12;(function() {
13 function foo() {
14 let first;
15 let second;
16 class A {};
17 first = A;
18 if (truth()) {
19 class A {};
20 second = A;
21 }
22 assert(first !== second);
23 }
24 function baz() {
25 class A { static hello() { return 10; } };
26 assert(A.hello() === 10);
27 if (truth()) {
28 class A { static hello() { return 20; } };
29 assert(A.hello() === 20);
30 }
31 assert(A.hello() === 10);
32 }
33 function bar() {
34 class A { static hello() { return 10; } };
35 let capA = function() { return A; }
36 assert(A.hello() === 10);
37 if (truth()) {
38 class A { static hello() { return 20; } };
39 let capA = function() { return A; }
40 assert(A.hello() === 20);
41 }
42 assert(A.hello() === 10);
43 }
44 for (let i = 0; i < NUM_LOOPS; i++) {
45 foo();
46 bar();
47 baz();
48 }
49})();