| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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-object-spread | 5 // Flags: --harmony-object-rest-spread |
| 6 | 6 |
| 7 var x = {a: 1}; | 7 var x = {a: 1}; |
| 8 var y = { ...x}; | 8 var y = { ...x}; |
| 9 assertEquals(x, y); | 9 assertEquals(x, y); |
| 10 | 10 |
| 11 assertEquals({}, y = { ...{} } ); | 11 assertEquals({}, y = { ...{} } ); |
| 12 assertEquals({}, y = { ...undefined }); | 12 assertEquals({}, y = { ...undefined }); |
| 13 assertEquals({}, y = { ...null }); | 13 assertEquals({}, y = { ...null }); |
| 14 | 14 |
| 15 assertEquals({}, y = { ...1 }); | 15 assertEquals({}, y = { ...1 }); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return Object.getOwnPropertyDescriptor(z, prop); | 102 return Object.getOwnPropertyDescriptor(z, prop); |
| 103 }, | 103 }, |
| 104 }); | 104 }); |
| 105 assertEquals(z, y = { ...p }); | 105 assertEquals(z, y = { ...p }); |
| 106 | 106 |
| 107 var x = { a:1 }; | 107 var x = { a:1 }; |
| 108 assertEquals(x, y = { set a(_) { throw new Error(); }, ...x }); | 108 assertEquals(x, y = { set a(_) { throw new Error(); }, ...x }); |
| 109 | 109 |
| 110 var x = { a:1 }; | 110 var x = { a:1 }; |
| 111 assertEquals(x, y = { get a() { throw new Error(); }, ...x }); | 111 assertEquals(x, y = { get a() { throw new Error(); }, ...x }); |
| OLD | NEW |