OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 // Property names are expected to be strings. | 653 // Property names are expected to be strings. |
654 for (var i = 0; i < propertyNames.length; ++i) | 654 for (var i = 0; i < propertyNames.length; ++i) |
655 propertyNames[i] = ToString(propertyNames[i]); | 655 propertyNames[i] = ToString(propertyNames[i]); |
656 | 656 |
657 return propertyNames; | 657 return propertyNames; |
658 } | 658 } |
659 | 659 |
660 | 660 |
661 // ES5 section 15.2.3.5. | 661 // ES5 section 15.2.3.5. |
662 function ObjectCreate(proto, properties) { | 662 function ObjectCreate(proto, properties) { |
663 if (!IS_OBJECT(proto) && !IS_NULL(proto)) { | 663 // IS_OBJECT will return true on null covering that case. |
| 664 if (!IS_OBJECT(proto) && !IS_FUNCTION(proto)) { |
664 throw MakeTypeError("proto_object_or_null", [proto]); | 665 throw MakeTypeError("proto_object_or_null", [proto]); |
665 } | 666 } |
666 var obj = new $Object(); | 667 var obj = new $Object(); |
667 obj.__proto__ = proto; | 668 obj.__proto__ = proto; |
668 if (!IS_UNDEFINED(properties)) ObjectDefineProperties(obj, properties); | 669 if (!IS_UNDEFINED(properties)) ObjectDefineProperties(obj, properties); |
669 return obj; | 670 return obj; |
670 } | 671 } |
671 | 672 |
672 | 673 |
673 // ES5 section 15.2.3.6. | 674 // ES5 section 15.2.3.6. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 | 1003 |
1003 // ---------------------------------------------------------------------------- | 1004 // ---------------------------------------------------------------------------- |
1004 | 1005 |
1005 function SetupFunction() { | 1006 function SetupFunction() { |
1006 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1007 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1007 "toString", FunctionToString | 1008 "toString", FunctionToString |
1008 )); | 1009 )); |
1009 } | 1010 } |
1010 | 1011 |
1011 SetupFunction(); | 1012 SetupFunction(); |
OLD | NEW |