OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 'use strict'; |
| 6 |
| 7 function SpreadArguments() { |
| 8 var count = %_ArgumentsLength(); |
| 9 var args = new InternalArray(); |
| 10 |
| 11 for (var i = 0; i < count; ++i) { |
| 12 var array = %_Arguments(i); |
| 13 var length = array.length; |
| 14 for (var j = 0; j < length; ++j) { |
| 15 args.push(array[j]); |
| 16 } |
| 17 } |
| 18 |
| 19 return args; |
| 20 } |
| 21 |
| 22 |
| 23 function SpreadIterable(collection) { |
| 24 if (IS_NULL_OR_UNDEFINED(collection)) { |
| 25 throw MakeTypeError("not_iterable", [collection]); |
| 26 } |
| 27 |
| 28 var args = new InternalArray(); |
| 29 for (var value of collection) { |
| 30 args.push(value); |
| 31 } |
| 32 return args; |
| 33 } |
OLD | NEW |