Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index dd776dbc8c354722c692c3580914398e5de26d30..e70666817321d2d60c7b7256ae9d20953663d8cc 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -766,7 +766,6 @@ function ToPrimitive(x, hint) { |
if (IS_STRING(x)) return x; |
// Normal behavior. |
if (!IS_SPEC_OBJECT(x)) return x; |
- if (IS_SYMBOL_WRAPPER(x)) throw MakeTypeError(kSymbolToPrimitive); |
bbudge
2015/07/28 19:07:30
Is this error part of the Spec? If so, we have to
rossberg
2015/07/29 11:49:11
No, the spec doesn't even recognise the existence
|
if (IS_FLOAT32X4(x)) return x; |
if (hint == NO_HINT) hint = (IS_DATE(x)) ? STRING_HINT : NUMBER_HINT; |
return (hint == NUMBER_HINT) ? DefaultNumber(x) : DefaultString(x); |
@@ -816,7 +815,7 @@ function ToString(x) { |
if (IS_NUMBER(x)) return %_NumberToString(x); |
if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; |
if (IS_UNDEFINED(x)) return 'undefined'; |
- if (IS_SYMBOL(x)) throw MakeTypeError(kSymbolToString); |
+ // Types that can't be converted to string are caught in DefaultString. |
return (IS_NULL(x)) ? 'null' : ToString(DefaultString(x)); |
} |
@@ -824,7 +823,7 @@ function NonStringToString(x) { |
if (IS_NUMBER(x)) return %_NumberToString(x); |
if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; |
if (IS_UNDEFINED(x)) return 'undefined'; |
- if (IS_SYMBOL(x)) throw MakeTypeError(kSymbolToString); |
+ // Types that can't be converted to string are caught in DefaultString. |
return (IS_NULL(x)) ? 'null' : ToString(DefaultString(x)); |
} |
@@ -963,6 +962,7 @@ function DefaultNumber(x) { |
// ECMA-262, section 8.6.2.6, page 28. |
function DefaultString(x) { |
if (!IS_SYMBOL_WRAPPER(x)) { |
+ if (IS_SYMBOL(x)) throw MakeTypeError(kSymbolToString); |
var toString = x.toString; |
if (IS_SPEC_FUNCTION(toString)) { |
var s = %_CallFunction(x, toString); |