| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 // | |
| 5 | |
| 6 (function(global, utils) { | |
| 7 | |
| 8 "use strict"; | |
| 9 | |
| 10 %CheckIsBootstrapping(); | |
| 11 | |
| 12 // ------------------------------------------------------------------- | |
| 13 // Imports | |
| 14 | |
| 15 var GlobalObject = global.Object; | |
| 16 var OwnPropertyKeys; | |
| 17 | |
| 18 utils.Import(function(from) { | |
| 19 OwnPropertyKeys = from.OwnPropertyKeys; | |
| 20 }); | |
| 21 | |
| 22 // ------------------------------------------------------------------- | |
| 23 | |
| 24 // ES6, draft 04-03-15, section 19.1.2.1 | |
| 25 function ObjectAssign(target, sources) { | |
| 26 var to = TO_OBJECT(target); | |
| 27 var argsLen = %_ArgumentsLength(); | |
| 28 if (argsLen < 2) return to; | |
| 29 | |
| 30 for (var i = 1; i < argsLen; ++i) { | |
| 31 var nextSource = %_Arguments(i); | |
| 32 if (IS_NULL_OR_UNDEFINED(nextSource)) { | |
| 33 continue; | |
| 34 } | |
| 35 | |
| 36 var from = TO_OBJECT(nextSource); | |
| 37 var keys = OwnPropertyKeys(from); | |
| 38 var len = keys.length; | |
| 39 | |
| 40 for (var j = 0; j < len; ++j) { | |
| 41 var key = keys[j]; | |
| 42 if (%IsPropertyEnumerable(from, key)) { | |
| 43 var propValue = from[key]; | |
| 44 to[key] = propValue; | |
| 45 } | |
| 46 } | |
| 47 } | |
| 48 return to; | |
| 49 } | |
| 50 | |
| 51 // Set up non-enumerable functions on the Object object. | |
| 52 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ | |
| 53 "assign", ObjectAssign | |
| 54 ]); | |
| 55 | |
| 56 }) | |
| OLD | NEW |