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

Side by Side Diff: test/mjsunit/harmony/default-parameters.js

Issue 1311163002: [es6] Correct length for functions with default parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/scopes.cc ('k') | test/mjsunit/harmony/destructuring.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-default-parameters --harmony-arrow-functions 5 // Flags: --harmony-default-parameters --harmony-arrow-functions
6 // Flags: --harmony-rest-parameters --harmony-destructuring 6 // Flags: --harmony-rest-parameters --harmony-destructuring
7 7
8 8
9 (function TestDefaults() { 9 (function TestDefaults() {
10 function f1(x = 1) { return x } 10 function f1(x = 1) { return x }
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 function f1(x = 900) { arguments[0] = 1; return x } 411 function f1(x = 900) { arguments[0] = 1; return x }
412 assertEquals(9, f1(9)); 412 assertEquals(9, f1(9));
413 assertEquals(900, f1()); 413 assertEquals(900, f1());
414 function f2(x = 1001) { x = 2; return arguments[0] } 414 function f2(x = 1001) { x = 2; return arguments[0] }
415 assertEquals(10, f2(10)); 415 assertEquals(10, f2(10));
416 assertEquals(undefined, f2()); 416 assertEquals(undefined, f2());
417 }()); 417 }());
418 418
419 419
420 (function TestFunctionLength() { 420 (function TestFunctionLength() {
421 // TODO(rossberg): Fix arity. 421 assertEquals(0, (function(x = 1) {}).length);
422 // assertEquals(0, (function(x = 1) {}).length); 422 assertEquals(0, (function(x = 1, ...a) {}).length);
423 // assertEquals(0, (function(x = 1, ...a) {}).length); 423 assertEquals(1, (function(x, y = 1) {}).length);
424 // assertEquals(1, (function(x, y = 1) {}).length); 424 assertEquals(1, (function(x, y = 1, ...a) {}).length);
425 // assertEquals(1, (function(x, y = 1, ...a) {}).length); 425 assertEquals(2, (function(x, y, z = 1) {}).length);
426 // assertEquals(2, (function(x, y, z = 1) {}).length); 426 assertEquals(2, (function(x, y, z = 1, ...a) {}).length);
427 // assertEquals(2, (function(x, y, z = 1, ...a) {}).length); 427 assertEquals(1, (function(x, y = 1, z) {}).length);
428 // assertEquals(1, (function(x, y = 1, z) {}).length); 428 assertEquals(1, (function(x, y = 1, z, ...a) {}).length);
429 // assertEquals(1, (function(x, y = 1, z, ...a) {}).length); 429 assertEquals(1, (function(x, y = 1, z, v = 2) {}).length);
430 // assertEquals(1, (function(x, y = 1, z, v = 2) {}).length); 430 assertEquals(1, (function(x, y = 1, z, v = 2, ...a) {}).length);
431 // assertEquals(1, (function(x, y = 1, z, v = 2, ...a) {}).length);
432 })(); 431 })();
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | test/mjsunit/harmony/destructuring.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698