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

Side by Side Diff: test/mjsunit/es6/rest-params-lazy-parsing.js

Issue 1519073004: Remove always-on --harmony-rest-parameters flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « test/mjsunit/es6/rest-params.js ('k') | test/mjsunit/es6/spread-call-new-class.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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-rest-parameters
6 // Flags: --min-preparse-length=0 5 // Flags: --min-preparse-length=0
7 6
8 function variadic(co, ...values) { 7 function variadic(co, ...values) {
9 var sum = 0; 8 var sum = 0;
10 while (values.length) { 9 while (values.length) {
11 sum += co * values.pop(); 10 sum += co * values.pop();
12 } 11 }
13 return sum; 12 return sum;
14 } 13 }
15 14
16 var arrowVariadic = (co, ...values) => { 15 var arrowVariadic = (co, ...values) => {
17 var sum = 0; 16 var sum = 0;
18 while (values.length) { 17 while (values.length) {
19 sum += co * values.pop(); 18 sum += co * values.pop();
20 } 19 }
21 return sum; 20 return sum;
22 } 21 }
23 22
24 assertEquals(1, variadic.length); 23 assertEquals(1, variadic.length);
25 assertEquals(1, arrowVariadic.length); 24 assertEquals(1, arrowVariadic.length);
26 25
27 assertEquals(90, variadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9)); 26 assertEquals(90, variadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9));
28 assertEquals(74, variadic(2, 1, 2, 3, 4, 5, 6, 7, 9)); 27 assertEquals(74, variadic(2, 1, 2, 3, 4, 5, 6, 7, 9));
29 assertEquals(110, variadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); 28 assertEquals(110, variadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
30 29
31 assertEquals(90, arrowVariadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9)); 30 assertEquals(90, arrowVariadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9));
32 assertEquals(74, arrowVariadic(2, 1, 2, 3, 4, 5, 6, 7, 9)); 31 assertEquals(74, arrowVariadic(2, 1, 2, 3, 4, 5, 6, 7, 9));
33 assertEquals(110, arrowVariadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); 32 assertEquals(110, arrowVariadic(2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
OLDNEW
« no previous file with comments | « test/mjsunit/es6/rest-params.js ('k') | test/mjsunit/es6/spread-call-new-class.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698