[JSC] AI should not propagate AbstractValue relying on constant folding phase
[WebKit-https.git] / JSTests / stress / direct-eval-in-object-literal-methods.js
1 function shouldBe(actual, expected) {
2     if (actual !== expected)
3         throw new Error('bad value: ' + actual);
4 }
5
6 {
7     let object = {
8         n()
9         {
10             return 42;
11         }
12     };
13
14     let derived = {
15         m()
16         {
17             return eval("super.n()");
18         }
19     };
20     Object.setPrototypeOf(derived, object);
21     shouldBe(derived.m(), 42);
22     // Cached.
23     shouldBe(derived.m(), 42);
24 }
25
26 {
27     let object = {
28         l()
29         {
30             return 42;
31         }
32     };
33
34     let derived = {
35         m()
36         {
37             return eval("super.l()");
38         }
39     };
40     Object.setPrototypeOf(derived, object);
41     shouldBe(derived.m(), 42);
42     // Cached.
43     shouldBe(derived.m(), 42);
44
45     class Parent {
46         l()
47         {
48             return 55;
49         }
50     }
51
52     class Derived extends Parent {
53         m()
54         {
55             return eval("super.l()");
56         }
57     }
58     let instance = new Derived();
59     // Under the strict code, not cached.
60     shouldBe(instance.l(), 55);
61     shouldBe(instance.l(), 55);
62 }