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

Side by Side Diff: src/harmony-spread.js

Issue 938443002: [es6] implement spread calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove --harmony-spread flag 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 var SpreadArguments;
8 var SpreadIterable;
9
10
11 function SetupSpreadHelpers() {
12 %CheckIsBootstrapping();
13
14 if (SpreadArguments) return;
15
16 SpreadArguments = function spreadArguments() {
17 var count = %_ArgumentsLength();
18 var args = new InternalArray();
19
20 for (var i = 0; i < count; ++i) {
21 var array = %_Arguments(i);
22 var length = array.length;
23 for (var j = 0; j < length; ++j) {
24 args.push(array[j]);
25 }
26 }
27
28 return args;
29 }
30
31 SpreadIterable = function spreadIterable(collection) {
32 if (IS_NULL_OR_UNDEFINED(collection)) {
arv (Not doing code reviews) 2015/03/30 22:19:49 Isn't this is already tested by for-of?
caitp (gmail) 2015/03/30 22:38:12 at the time I wrote it, it was a reference error t
33 throw MakeTypeError("not_iterable", [collection]);
34 }
35
36 var args = new InternalArray();
37 for (var value of collection) {
38 args.push(value);
39 }
40 return args;
41 }
42 }
43
44 SetupSpreadHelpers();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698