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

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

Issue 1128043006: [destructuring] Adapting PatternRewriter to work in for-statements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 7 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/pattern-rewriter.cc ('k') | tools/gyp/v8.gyp » ('j') | 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 0ddda04285b29cb645e1ff38db56226e6255d470..3cfb6fc528ec6f981108d16b271251b6a3c6e3b7 100644
--- a/test/mjsunit/harmony/destructuring.js
+++ b/test/mjsunit/harmony/destructuring.js
@@ -11,4 +11,46 @@
var {z} = { z : 3 };
assertEquals(3, z);
+
+
+ var sum = 0;
+ for(var {z} = { z : 3 }; z != 0; z--) {
+ sum += z;
+ }
+ assertEquals(6, sum);
+}());
+
+
+(function TestObjectLiteralPatternLexical() {
+ 'use strict';
+ let { x : x, y : y } = { x : 1, y : 2 };
+ assertEquals(1, x);
+ assertEquals(2, y);
+
+ let {z} = { z : 3 };
+ assertEquals(3, z);
+
+
+ let sum = 0;
+ for(let {x, z} = { x : 0, z : 3 }; z != 0; z--) {
+ assertEquals(0, x);
+ sum += z;
+ }
+ assertEquals(6, sum);
+}());
+
+
+(function TestObjectLiteralPatternLexicalConst() {
+ 'use strict';
+ const { x : x, y : y } = { x : 1, y : 2 };
+ assertEquals(1, x);
+ assertEquals(2, y);
+
+ const {z} = { z : 3 };
+ assertEquals(3, z);
+
+
+ for(const {x, z} = { x : 0, z : 3 }; z != 3 || x != 0;) {
+ assertTrue(false);
+ }
}());
« no previous file with comments | « src/pattern-rewriter.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698