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-destructuring-bind | 5 // Flags: --harmony-destructuring-bind |
6 // Flags: --harmony-default-parameters | 6 // Flags: --harmony-default-parameters |
7 | 7 |
8 (function TestObjectLiteralPattern() { | 8 (function TestObjectLiteralPattern() { |
9 var { x : x, y : y, get, set } = { x : 1, y : 2, get: 3, set: 4 }; | 9 var { x : x, y : y, get, set } = { x : 1, y : 2, get: 3, set: 4 }; |
10 assertEquals(1, x); | 10 assertEquals(1, x); |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 try { | 1124 try { |
1125 throw [1, 2, 3]; | 1125 throw [1, 2, 3]; |
1126 } catch ([foo, ...bar]) { | 1126 } catch ([foo, ...bar]) { |
1127 assertEquals(1, foo); | 1127 assertEquals(1, foo); |
1128 assertEquals([2, 3], bar); | 1128 assertEquals([2, 3], bar); |
1129 } | 1129 } |
1130 | 1130 |
1131 assertEquals("hello", foo); | 1131 assertEquals("hello", foo); |
1132 assertEquals("world", bar); | 1132 assertEquals("world", bar); |
1133 assertEquals(42, baz); | 1133 assertEquals(42, baz); |
| 1134 |
| 1135 assertEquals(undefined, eval('try {throw {foo: 1, bar: 2}} catch({foo}) {}')); |
| 1136 assertEquals(undefined, eval('try {throw [1, 2, 3]} catch([x]) {}')); |
1134 })(); | 1137 })(); |
OLD | NEW |