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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 function ObjectLookupSetter(name) { | 271 function ObjectLookupSetter(name) { |
272 if (this == null) { | 272 if (this == null) { |
273 throw new $TypeError('Object.prototype.__lookupSetter__: this is Null'); | 273 throw new $TypeError('Object.prototype.__lookupSetter__: this is Null'); |
274 } | 274 } |
275 return %LookupAccessor(ToObject(this), ToString(name), SETTER); | 275 return %LookupAccessor(ToObject(this), ToString(name), SETTER); |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 function ObjectKeys(obj) { | 279 function ObjectKeys(obj) { |
280 if (!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) | 280 if ((!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) && !IS_FUNCTION(obj)) |
281 throw MakeTypeError('object_keys_non_object', [obj]); | 281 throw MakeTypeError('object_keys_non_object', [obj]); |
282 return %LocalKeys(obj); | 282 return %LocalKeys(obj); |
283 } | 283 } |
284 | 284 |
285 | 285 |
286 %SetCode($Object, function(x) { | 286 %SetCode($Object, function(x) { |
287 if (%_IsConstructCall()) { | 287 if (%_IsConstructCall()) { |
288 if (x == null) return this; | 288 if (x == null) return this; |
289 return ToObject(x); | 289 return ToObject(x); |
290 } else { | 290 } else { |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 579 |
580 // ---------------------------------------------------------------------------- | 580 // ---------------------------------------------------------------------------- |
581 | 581 |
582 function SetupFunction() { | 582 function SetupFunction() { |
583 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 583 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
584 "toString", FunctionToString | 584 "toString", FunctionToString |
585 )); | 585 )); |
586 } | 586 } |
587 | 587 |
588 SetupFunction(); | 588 SetupFunction(); |
OLD | NEW |