| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-species --harmony-proxies | 5 // Flags: --harmony-species |
| 6 | 6 |
| 7 // Test the ES2015 @@species feature | 7 // Test the ES2015 @@species feature |
| 8 | 8 |
| 9 'use strict'; | 9 'use strict'; |
| 10 | 10 |
| 11 // Subclasses of Array construct themselves under map, etc | 11 // Subclasses of Array construct themselves under map, etc |
| 12 | 12 |
| 13 class MyArray extends Array { } | 13 class MyArray extends Array { } |
| 14 | 14 |
| 15 assertEquals(MyArray, new MyArray().map(()=>{}).constructor); | 15 assertEquals(MyArray, new MyArray().map(()=>{}).constructor); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 assertArrayEquals([0], params); | 164 assertArrayEquals([0], params); |
| 165 | 165 |
| 166 // @@species constructor can be a Proxy, and the realm access doesn't | 166 // @@species constructor can be a Proxy, and the realm access doesn't |
| 167 // crash | 167 // crash |
| 168 | 168 |
| 169 class MyProxyArray extends Array { } | 169 class MyProxyArray extends Array { } |
| 170 let ProxyArray = new Proxy(MyProxyArray, {}); | 170 let ProxyArray = new Proxy(MyProxyArray, {}); |
| 171 MyProxyArray.constructor = ProxyArray; | 171 MyProxyArray.constructor = ProxyArray; |
| 172 | 172 |
| 173 assertEquals(MyProxyArray, new ProxyArray().map(()=>{}).constructor); | 173 assertEquals(MyProxyArray, new ProxyArray().map(()=>{}).constructor); |
| OLD | NEW |