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

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

Issue 1859423002: [es6] Fix bug in pattern re-writing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months 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 | « src/parsing/pattern-rewriter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/destructuring.js
diff --git a/test/mjsunit/es6/destructuring.js b/test/mjsunit/es6/destructuring.js
index d15805711f0a82324acbeee48f57c0f69da73307..1f16c45270a9574d22f60865fbe1ca0377eb40e3 100644
--- a/test/mjsunit/es6/destructuring.js
+++ b/test/mjsunit/es6/destructuring.js
@@ -260,6 +260,63 @@
}());
+(function TestAssignmentExprInInitializers() {
+ {
+ let x, y;
+ {
+ let { x = y = 1 } = {};
+ assertSame(x, 1);
+ assertSame(y, 1);
+ }
+ assertSame(undefined, x);
+ assertSame(1, y);
+ }
+
+ {
+ let x, y;
+ {
+ let { x: x = y = 1 } = {};
+ assertSame(1, x);
+ assertSame(1, y);
+ }
+ assertSame(undefined, x);
+ assertSame(1, y);
+ }
+
+ {
+ let x, y;
+ {
+ let [ x = y = 1 ] = [];
+ assertSame(1, x);
+ assertSame(1, y);
+ }
+ assertSame(undefined, x);
+ assertSame(1, y);
+ }
+
+ {
+ let x, y;
+ (function({ x = y = 1 }) {}({}));
+ assertSame(undefined, x);
+ assertSame(1, y);
+ }
+
+ {
+ let x, y;
+ (function({ x: x = y = 1 }) {}({}));
+ assertSame(undefined, x);
+ assertSame(1, y);
+ }
+
+ {
+ let x, y;
+ (function([ x = y = 1 ]) {}([]));
+ assertSame(undefined, x);
+ assertSame(1, y);
+ }
+}());
+
+
(function TestMultipleAccesses() {
assertThrows(
"'use strict';"+
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698