| Index: src/symbol.js
|
| diff --git a/src/symbol.js b/src/symbol.js
|
| index 8cac2c56a2f69cfa8397c6c13bb0d07ef9f33f1f..3f6e281777086cb9317071a730767db99c9db157 100644
|
| --- a/src/symbol.js
|
| +++ b/src/symbol.js
|
| @@ -7,6 +7,7 @@
|
| // - symbolIsConcatSpreadable
|
| // - symbolIsRegExp
|
| // - symbolIterator
|
| +// - symbolToPrimitive
|
| // - symbolToStringTag
|
| // - symbolUnscopables
|
|
|
| @@ -40,6 +41,16 @@ function SymbolConstructor(x) {
|
| }
|
|
|
|
|
| +// 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint )
|
| +function SymbolToPrimitive(hint) {
|
| + if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) {
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + "Symbol.prototype [ @@toPrimitive ]", this);
|
| + }
|
| + return %_ValueOf(this);
|
| +}
|
| +
|
| +
|
| function SymbolToString() {
|
| if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) {
|
| throw MakeTypeError(kIncompatibleMethodReceiver,
|
| @@ -97,6 +108,7 @@ utils.InstallConstants(GlobalSymbol, [
|
| // "isConcatSpreadable", symbolIsConcatSpreadable,
|
| // "isRegExp", symbolIsRegExp,
|
| "iterator", symbolIterator,
|
| + "toPrimitive", symbolToPrimitive,
|
| // TODO(dslomov, caitp): Currently defined in harmony-tostring.js ---
|
| // Move here when shipping
|
| // "toStringTag", symbolToStringTag,
|
| @@ -110,6 +122,10 @@ utils.InstallFunctions(GlobalSymbol, DONT_ENUM, [
|
|
|
| %AddNamedProperty(
|
| GlobalSymbol.prototype, "constructor", GlobalSymbol, DONT_ENUM);
|
| +utils.SetFunctionName(SymbolToPrimitive, symbolToPrimitive);
|
| +%AddNamedProperty(
|
| + GlobalSymbol.prototype, symbolToPrimitive, SymbolToPrimitive,
|
| + DONT_ENUM | READ_ONLY);
|
| %AddNamedProperty(
|
| GlobalSymbol.prototype, symbolToStringTag, "Symbol", DONT_ENUM | READ_ONLY);
|
|
|
|
|