OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-classes --allow-natives-syntax | 5 // Flags: --harmony-classes --harmony-arrow-functions --allow-natives-syntax |
6 | 6 |
7 | 7 |
8 (function TestHomeObject() { | 8 (function TestHomeObject() { |
9 var object = { | 9 var object = { |
10 method() { | 10 method() { |
11 return super.method(); | 11 return super.method(); |
12 }, | 12 }, |
13 get getter() { | 13 get getter() { |
14 return super.getter; | 14 return super.getter; |
15 }, | 15 }, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return 42; | 124 return 42; |
125 } | 125 } |
126 }, | 126 }, |
127 *g() { | 127 *g() { |
128 yield super.m(); | 128 yield super.m(); |
129 }, | 129 }, |
130 }; | 130 }; |
131 | 131 |
132 assertEquals(42, o.g().next().value); | 132 assertEquals(42, o.g().next().value); |
133 })(); | 133 })(); |
| 134 |
| 135 |
| 136 (function TestSuperPropertyInEval() { |
| 137 var y = 3; |
| 138 var p = { |
| 139 m() { return 1; }, |
| 140 get x() { return 2; }, |
| 141 set y(v) { y = v; } |
| 142 }; |
| 143 var o = { |
| 144 __proto__: p, |
| 145 eval() { |
| 146 assertSame(super.x, eval('super.x')); |
| 147 assertSame(super.m(), eval('super.m()')); |
| 148 // Global eval. |
| 149 assertThrows('super.x', SyntaxError); |
| 150 assertThrows('super.m()', SyntaxError); |
| 151 return eval('super.m()'); |
| 152 }, |
| 153 arrow() { |
| 154 assertSame(super.x, (() => super.x)()); |
| 155 assertSame(super.m(), (() => super.m())()); |
| 156 return (() => super.m())(); |
| 157 } |
| 158 }; |
| 159 assertSame(1, o.eval()); |
| 160 assertSame(1, o.arrow()); |
| 161 })(); |
OLD | NEW |