OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 var unscopablesSymbol = utils.ImportNow("unscopables_symbol"); | 25 var unscopablesSymbol = utils.ImportNow("unscopables_symbol"); |
26 | 26 |
27 utils.Import(function(from) { | 27 utils.Import(function(from) { |
28 ObjectGetOwnPropertyKeys = from.ObjectGetOwnPropertyKeys; | 28 ObjectGetOwnPropertyKeys = from.ObjectGetOwnPropertyKeys; |
29 ToString = from.ToString; | 29 ToString = from.ToString; |
30 }); | 30 }); |
31 | 31 |
32 // ------------------------------------------------------------------- | 32 // ------------------------------------------------------------------- |
33 | 33 |
34 function SymbolConstructor(x) { | 34 function SymbolConstructor(x) { |
35 "use strict"; | |
Michael Starzinger
2015/09/15 13:09:58
The entire module is already strict, let's drop it
| |
35 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Symbol"); | 36 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Symbol"); |
36 // NOTE: Passing in a Symbol value will throw on ToString(). | 37 // NOTE: Passing in a Symbol value will throw on ToString(). |
37 return %CreateSymbol(IS_UNDEFINED(x) ? x : ToString(x)); | 38 return %CreateSymbol(IS_UNDEFINED(x) ? x : ToString(x)); |
38 } | 39 } |
39 | 40 |
40 | 41 |
41 // 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) | 42 // 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) |
42 function SymbolToPrimitive(hint) { | 43 function SymbolToPrimitive(hint) { |
43 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { | 44 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { |
44 throw MakeTypeError(kIncompatibleMethodReceiver, | 45 throw MakeTypeError(kIncompatibleMethodReceiver, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 ]); | 137 ]); |
137 | 138 |
138 // ------------------------------------------------------------------- | 139 // ------------------------------------------------------------------- |
139 // Exports | 140 // Exports |
140 | 141 |
141 utils.Export(function(to) { | 142 utils.Export(function(to) { |
142 to.SymbolToString = SymbolToString; | 143 to.SymbolToString = SymbolToString; |
143 }) | 144 }) |
144 | 145 |
145 }) | 146 }) |
OLD | NEW |