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: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 (function TestSuperNamedLoads() { | 7 (function TestSuperNamedLoads() { |
8 function Base() { } | 8 function Base() { } |
9 function fBase() { } | 9 function fBase() { } |
10 Base.prototype = { | 10 Base.prototype = { |
(...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 } | 2206 } |
2207 class Derived extends Base { | 2207 class Derived extends Base { |
2208 constructor(x) { | 2208 constructor(x) { |
2209 let r = (() => super(...[x]))(); | 2209 let r = (() => super(...[x]))(); |
2210 assertEquals(this, r); | 2210 assertEquals(this, r); |
2211 } | 2211 } |
2212 } | 2212 } |
2213 let d = new Derived(42); | 2213 let d = new Derived(42); |
2214 assertSame(42, d.x); | 2214 assertSame(42, d.x); |
2215 })(); | 2215 })(); |
| 2216 |
| 2217 (function TestNullSuperPropertyLoad() { |
| 2218 var obj = { |
| 2219 __proto__: null, |
| 2220 named() { return super.x }, |
| 2221 keyed() { return super[5] } |
| 2222 }; |
| 2223 assertThrows(obj.named, TypeError); |
| 2224 assertThrows(obj.keyed, TypeError); |
| 2225 class C extends null { |
| 2226 named() { return super.x } |
| 2227 keyed() { return super[5] } |
| 2228 } |
| 2229 assertThrows(C.prototype.named, TypeError); |
| 2230 assertThrows(C.prototype.keyed, TypeError); |
| 2231 })(); |
| 2232 |
| 2233 (function TestNullSuperPropertyStore() { |
| 2234 var obj = { |
| 2235 __proto__: null, |
| 2236 named() { super.x = 42 }, |
| 2237 keyed() { super[5] = 42 } |
| 2238 }; |
| 2239 assertThrows(obj.named, TypeError); |
| 2240 assertThrows(obj.keyed, TypeError); |
| 2241 class C extends null { |
| 2242 named() { super.x = 42 } |
| 2243 keyed() { super[5] = 42 } |
| 2244 } |
| 2245 assertThrows(C.prototype.named, TypeError); |
| 2246 assertThrows(C.prototype.keyed, TypeError); |
| 2247 })(); |
OLD | NEW |