Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/mjsunit/harmony/destructuring.js

Issue 1411323008: Revert "Revert of [es6] Implement destructuring binding in try/catch" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: initialization_pos fix Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/message/try-catch-variable-conflict.out ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1100
1101
1101 (function TestLegacyConstDestructuringInForLoop() { 1102 (function TestLegacyConstDestructuringInForLoop() {
1102 var result; 1103 var result;
1103 for (const {foo} of [{foo: 1}]) { result = foo; } 1104 for (const {foo} of [{foo: 1}]) { result = foo; }
1104 assertEquals(1, result); 1105 assertEquals(1, result);
1105 })(); 1106 })();
1107
1108
1109 (function TestCatch() {
1110 "use strict";
1111
1112 // For testing proper scoping.
1113 var foo = "hello", bar = "world", baz = 42;
1114
1115 try {
1116 throw {foo: 1, bar: 2};
1117 } catch ({foo, bar, baz = 3}) {
1118 assertEquals(1, foo);
1119 assertEquals(2, bar);
1120 assertEquals(3, baz);
1121 }
1122
1123 try {
1124 throw [1, 2, 3];
1125 } catch ([foo, ...bar]) {
1126 assertEquals(1, foo);
1127 assertEquals([2, 3], bar);
1128 }
1129
1130 assertEquals("hello", foo);
1131 assertEquals("world", bar);
1132 assertEquals(42, baz);
1133 })();
OLDNEW
« no previous file with comments | « test/message/try-catch-variable-conflict.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698