OLD | NEW |
(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 } |
OLD | NEW |