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

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

Issue 1189743003: [destructuring] Implement parameter pattern matching. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« src/scopes.h ('K') | « src/x87/full-codegen-x87.cc ('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 731bc6dbe5c6c3a1b9fc10e80dcde7371c16bfb6..3c08623a53be814fdf43ad98b03ad89ac5d39558 100644
--- a/test/mjsunit/harmony/destructuring.js
+++ b/test/mjsunit/harmony/destructuring.js
@@ -3,6 +3,7 @@
// found in the LICENSE file.
//
// Flags: --harmony-destructuring --harmony-computed-property-names
+// Flags: --harmony-arrow-functions
(function TestObjectLiteralPattern() {
var { x : x, y : y } = { x : 1, y : 2 };
@@ -686,3 +687,24 @@
assertEquals('ab', sx);
assertEquals('12', sy);
}());
+
+
+(function TestParameters() {
rossberg 2015/06/16 17:02:13 Can we have a few more tests? In particular, inclu
Dmitry Lomov (no reviews) 2015/06/19 15:25:14 Done.
+ function f({a, b}) { return a - b; }
+ assertEquals(1, f({a : 6, b : 5}));
+
+ function f1(c, {a, b}) { return c + a - b; }
+ assertEquals(8, f1(7, {a : 6, b : 5}));
+
+ var g = {a, b} => { return a - b; };
arv (Not doing code reviews) 2015/06/16 16:56:36 This should be a SyntaxError. Only when using a si
Dmitry Lomov (no reviews) 2015/06/19 15:25:14 Done.
+ assertEquals(1, g({a : 6, b : 5}));
+
+ var g1 = (c, {a, b}) => { return c + a - b; };
+ assertEquals(8, g1(7, {a : 6, b : 5}));
+
+ var h = {a, b} => a - b;
rossberg 2015/06/16 17:02:13 AFAICT this is not legal ES6 syntax, see the gramm
Dmitry Lomov (no reviews) 2015/06/19 15:25:14 Done.
+ assertEquals(1, h({a : 6, b : 5}));
+
+ var h1 = (c, {a, b}) => c + a - b;
+ assertEquals(8, h1(7, {a : 6, b : 5}));
+}());
« src/scopes.h ('K') | « src/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698