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 | 5 // Flags: --harmony-destructuring |
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, 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 1079 matching lines...) Loading... |
1090 assertThrows(function(){ eval("({}) => {'use strict';}") }, SyntaxError); | 1090 assertThrows(function(){ eval("({}) => {'use strict';}") }, SyntaxError); |
1091 assertThrows( | 1091 assertThrows( |
1092 function(){ eval("(class{foo({}) {'use strict';}});") }, SyntaxError); | 1092 function(){ eval("(class{foo({}) {'use strict';}});") }, SyntaxError); |
1093 | 1093 |
1094 assertThrows( | 1094 assertThrows( |
1095 function(){ eval("function(a, {}){'use strict';}") }, SyntaxError); | 1095 function(){ eval("function(a, {}){'use strict';}") }, SyntaxError); |
1096 assertThrows(function(){ eval("(a, {}) => {'use strict';}") }, SyntaxError); | 1096 assertThrows(function(){ eval("(a, {}) => {'use strict';}") }, SyntaxError); |
1097 assertThrows( | 1097 assertThrows( |
1098 function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError); | 1098 function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError); |
1099 })(); | 1099 })(); |
| 1100 |
| 1101 (function TestLegacyConstDestructuringInForLoop() { |
| 1102 var result; |
| 1103 for (const {foo} of [{foo: 1}]) { result = foo; } |
| 1104 assertEquals(1, result); |
| 1105 })(); |
OLD | NEW |