OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
6 // in runtime.js: | 6 // in runtime.js: |
7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
(...skipping 28 matching lines...) Expand all Loading... | |
39 %FunctionRemovePrototype(f); | 39 %FunctionRemovePrototype(f); |
40 %SetNativeFlag(f); | 40 %SetNativeFlag(f); |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 // Helper function to install a getter-only accessor property. | 44 // Helper function to install a getter-only accessor property. |
45 function InstallGetter(object, name, getter, attributes) { | 45 function InstallGetter(object, name, getter, attributes) { |
46 if (typeof attributes == "undefined") { | 46 if (typeof attributes == "undefined") { |
47 attributes = DONT_ENUM; | 47 attributes = DONT_ENUM; |
48 } | 48 } |
49 %FunctionSetName(getter, name); | 49 %FunctionSetName(getter, `get ${ |
caitp (gmail)
2015/04/23 19:23:45
templates makes it look more readable, but remembe
arv (Not doing code reviews)
2015/04/23 19:51:53
Changed to +. It does not get too ugly.
| |
50 IS_SYMBOL(name) ? `[${%SymbolDescription(name)}]` : name}`); | |
50 %FunctionRemovePrototype(getter); | 51 %FunctionRemovePrototype(getter); |
51 %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes); | 52 %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes); |
52 %SetNativeFlag(getter); | 53 %SetNativeFlag(getter); |
53 } | 54 } |
54 | 55 |
55 | 56 |
56 // Helper function to install a getter/setter accessor property. | 57 // Helper function to install a getter/setter accessor property. |
57 function InstallGetterSetter(object, name, getter, setter) { | 58 function InstallGetterSetter(object, name, getter, setter) { |
58 %FunctionSetName(getter, name); | 59 var functionName = IS_SYMBOL(name) ? `[${%SymbolDescription(name)}]` : name; |
59 %FunctionSetName(setter, name); | 60 %FunctionSetName(getter, `get ${functionName}`); |
61 %FunctionSetName(setter, `set ${functionName}`); | |
60 %FunctionRemovePrototype(getter); | 62 %FunctionRemovePrototype(getter); |
61 %FunctionRemovePrototype(setter); | 63 %FunctionRemovePrototype(setter); |
62 %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); | 64 %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); |
63 %SetNativeFlag(getter); | 65 %SetNativeFlag(getter); |
64 %SetNativeFlag(setter); | 66 %SetNativeFlag(setter); |
65 } | 67 } |
66 | 68 |
67 | 69 |
68 // Helper function for installing constant properties on objects. | 70 // Helper function for installing constant properties on objects. |
69 function InstallConstants(object, constants) { | 71 function InstallConstants(object, constants) { |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1894 } | 1896 } |
1895 if (!IS_SPEC_FUNCTION(method)) { | 1897 if (!IS_SPEC_FUNCTION(method)) { |
1896 throw MakeTypeError(kNotIterable, obj); | 1898 throw MakeTypeError(kNotIterable, obj); |
1897 } | 1899 } |
1898 var iterator = %_CallFunction(obj, method); | 1900 var iterator = %_CallFunction(obj, method); |
1899 if (!IS_SPEC_OBJECT(iterator)) { | 1901 if (!IS_SPEC_OBJECT(iterator)) { |
1900 throw MakeTypeError(kNotAnIterator, iterator); | 1902 throw MakeTypeError(kNotAnIterator, iterator); |
1901 } | 1903 } |
1902 return iterator; | 1904 return iterator; |
1903 } | 1905 } |
OLD | NEW |