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

Unified Diff: test/mjsunit/harmony/destructuring.js

Issue 1409093005: Re-re-land "[es6] Implement destructuring binding in try/catch" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/message/try-catch-variable-conflict.out ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/destructuring.js
diff --git a/test/mjsunit/harmony/destructuring.js b/test/mjsunit/harmony/destructuring.js
index 904058618ad23cb5520bba639a8fb14615b2c5ca..7192d7aa5b1cf05fcb51fe096eaf96d1ab06332b 100644
--- a/test/mjsunit/harmony/destructuring.js
+++ b/test/mjsunit/harmony/destructuring.js
@@ -1098,8 +1098,36 @@
function(){ eval("(class{foo(a, {}) {'use strict';}});") }, SyntaxError);
})();
+
(function TestLegacyConstDestructuringInForLoop() {
var result;
for (const {foo} of [{foo: 1}]) { result = foo; }
assertEquals(1, result);
})();
+
+
+(function TestCatch() {
+ "use strict";
+
+ // For testing proper scoping.
+ var foo = "hello", bar = "world", baz = 42;
+
+ try {
+ throw {foo: 1, bar: 2};
+ } catch ({foo, bar, baz = 3}) {
+ assertEquals(1, foo);
+ assertEquals(2, bar);
+ assertEquals(3, baz);
+ }
+
+ try {
+ throw [1, 2, 3];
+ } catch ([foo, ...bar]) {
+ assertEquals(1, foo);
+ assertEquals([2, 3], bar);
+ }
+
+ assertEquals("hello", foo);
+ assertEquals("world", bar);
+ assertEquals(42, baz);
+})();
« 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