| 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 --harmony-arrow-functions | 5 // Flags: --harmony-destructuring --harmony-arrow-functions |
| 6 // Flags: --harmony-default-parameters --harmony-rest-parameters | 6 // Flags: --harmony-default-parameters --harmony-rest-parameters |
| 7 | 7 |
| 8 (function TestObjectLiteralPattern() { | 8 (function TestObjectLiteralPattern() { |
| 9 var { x : x, y : y } = { x : 1, y : 2 }; | 9 var { x : x, y : y, get, set } = { x : 1, y : 2, get: 3, set: 4 }; |
| 10 assertEquals(1, x); | 10 assertEquals(1, x); |
| 11 assertEquals(2, y); | 11 assertEquals(2, y); |
| 12 assertEquals(3, get); |
| 13 assertEquals(4, set); |
| 12 | 14 |
| 13 var {z} = { z : 3 }; | 15 var {z} = { z : 3 }; |
| 14 assertEquals(3, z); | 16 assertEquals(3, z); |
| 15 | 17 |
| 16 | 18 |
| 17 var sum = 0; | 19 var sum = 0; |
| 18 for (var {z} = { z : 3 }; z != 0; z--) { | 20 for (var {z} = { z : 3 }; z != 0; z--) { |
| 19 sum += z; | 21 sum += z; |
| 20 } | 22 } |
| 21 assertEquals(6, sum); | 23 assertEquals(6, sum); |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 assertThrows(function(){ eval("({}) => {'use strict';}") }, SyntaxError); | 1016 assertThrows(function(){ eval("({}) => {'use strict';}") }, SyntaxError); |
| 1015 assertThrows( | 1017 assertThrows( |
| 1016 function(){ eval("(class{foo({}) {'use strict';}});") }, SyntaxError); | 1018 function(){ eval("(class{foo({}) {'use strict';}});") }, SyntaxError); |
| 1017 | 1019 |
| 1018 assertThrows( | 1020 assertThrows( |
| 1019 function(){ eval("function(a, {}){'use strict';}") }, SyntaxError); | 1021 function(){ eval("function(a, {}){'use strict';}") }, SyntaxError); |
| 1020 assertThrows(function(){ eval("(a, {}) => {'use strict';}") }, SyntaxError); | 1022 assertThrows(function(){ eval("(a, {}) => {'use strict';}") }, SyntaxError); |
| 1021 assertThrows( | 1023 assertThrows( |
| 1022 function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError); | 1024 function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError); |
| 1023 })(); | 1025 })(); |
| OLD | NEW |