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

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: Add more variations to evaluation order tests Created 5 years, 10 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 // -------------------------------------------------------------------
8
9 function SpreadArguments() {
10 var count = %_ArgumentsLength();
11 var args = new InternalArray();
12
13 for (var i = 0; i < count; ++i) {
14 var array = %_Arguments(i);
15 var length = array.length;
16 for (var j = 0; j < length; ++j) {
17 args.push(array[j]);
18 }
19 }
20
21 return args;
22 }
23
24 function SpreadIterable(collection) {
25 if (IS_NULL_OR_UNDEFINED(collection)) {
26 throw MakeTypeError("not_iterable", [collection]);
27 }
28
29 var args = new InternalArray();
30 for (var value of collection) {
31 args.push(value);
32 }
33 return args;
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698