| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 319 } |
| 320 | 320 |
| 321 | 321 |
| 322 function IsInconsistentDescriptor(desc) { | 322 function IsInconsistentDescriptor(desc) { |
| 323 return IsAccessorDescriptor(desc) && IsDataDescriptor(desc); | 323 return IsAccessorDescriptor(desc) && IsDataDescriptor(desc); |
| 324 } | 324 } |
| 325 | 325 |
| 326 // ES5 8.10.4 | 326 // ES5 8.10.4 |
| 327 function FromPropertyDescriptor(desc) { | 327 function FromPropertyDescriptor(desc) { |
| 328 if (IS_UNDEFINED(desc)) return desc; | 328 if (IS_UNDEFINED(desc)) return desc; |
| 329 var obj = new $Object(); | 329 |
| 330 if (IsDataDescriptor(desc)) { | 330 if (IsDataDescriptor(desc)) { |
| 331 obj.value = desc.getValue(); | 331 return { value: desc.getValue(), |
| 332 obj.writable = desc.isWritable(); | 332 writable: desc.isWritable(), |
| 333 enumerable: desc.isEnumerable(), |
| 334 configurable: desc.isConfigurable() }; |
| 333 } | 335 } |
| 334 if (IsAccessorDescriptor(desc)) { | 336 // Must be an AccessorDescriptor then. We never return a generic descriptor. |
| 335 obj.get = desc.getGet(); | 337 return { get: desc.getGet(), |
| 336 obj.set = desc.getSet(); | 338 set: desc.getSet(), |
| 337 } | 339 enumerable: desc.isEnumerable(), |
| 338 obj.enumerable = desc.isEnumerable(); | 340 configurable: desc.isConfigurable() }; |
| 339 obj.configurable = desc.isConfigurable(); | |
| 340 return obj; | |
| 341 } | 341 } |
| 342 | 342 |
| 343 // ES5 8.10.5. | 343 // ES5 8.10.5. |
| 344 function ToPropertyDescriptor(obj) { | 344 function ToPropertyDescriptor(obj) { |
| 345 if (!IS_SPEC_OBJECT(obj)) { | 345 if (!IS_SPEC_OBJECT(obj)) { |
| 346 throw MakeTypeError("property_desc_object", [obj]); | 346 throw MakeTypeError("property_desc_object", [obj]); |
| 347 } | 347 } |
| 348 var desc = new PropertyDescriptor(); | 348 var desc = new PropertyDescriptor(); |
| 349 | 349 |
| 350 if ("enumerable" in obj) { | 350 if ("enumerable" in obj) { |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 // ---------------------------------------------------------------------------- | 1302 // ---------------------------------------------------------------------------- |
| 1303 | 1303 |
| 1304 function SetupFunction() { | 1304 function SetupFunction() { |
| 1305 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1305 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1306 "bind", FunctionBind, | 1306 "bind", FunctionBind, |
| 1307 "toString", FunctionToString | 1307 "toString", FunctionToString |
| 1308 )); | 1308 )); |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 SetupFunction(); | 1311 SetupFunction(); |
| OLD | NEW |