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

Unified Diff: test/mjsunit/harmony/rest-params.js

Issue 1018043003: [es6] generate rest parameters correctly for subclass constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Test that rest params have same elements as arguments object, too Created 5 years, 9 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/x64/full-codegen-x64.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/rest-params.js
diff --git a/test/mjsunit/harmony/rest-params.js b/test/mjsunit/harmony/rest-params.js
index 5bb258ee68ede31e86a6554f2756f00e01b4ac90..341cb3308755207438349ab57e7af42b24cfffdf 100644
--- a/test/mjsunit/harmony/rest-params.js
+++ b/test/mjsunit/harmony/rest-params.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-rest-parameters
+// Flags: --harmony-rest-parameters --harmony-classes
(function testRestIndex() {
assertEquals(5, (function(...args) { return args.length; })(1,2,3,4,5));
@@ -180,3 +180,35 @@ var O = {
assertEquals([], ((...args) => args)());
assertEquals([1,2,3], ((...args) => args)(1,2,3));
})();*/
+
+
+(function testRestParamsWithNewTarget() {
+ "use strict";
+ class Base {
+ constructor(...a) {
+ this.base = a;
+ assertEquals(arguments.length, a.length);
+ var args = [];
+ for (var i = 0; i < arguments.length; ++i) {
+ args.push(arguments[i]);
+ }
+ assertEquals(args, a);
+ }
+ }
+ class Child extends Base {
+ constructor(...b) {
+ super(1, 2, 3);
+ this.child = b;
+ assertEquals(arguments.length, b.length);
+ var args = [];
+ for (var i = 0; i < arguments.length; ++i) {
+ args.push(arguments[i]);
+ }
+ assertEquals(args, b);
+ }
+ }
+
+ var c = new Child(1, 2, 3);
+ assertEquals([1, 2, 3], c.child);
+ assertEquals([1, 2, 3], c.base);
+})();
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698