Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index 6b487349d25366179dcc7afdfe65c525ea83356a..09b39ffe1d0c857409ed86ceaabda299215f8a40 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -346,7 +346,7 @@ function SHR(y) { |
// ECMA-262, section 11.4.1, page 46. |
function DELETE(key, strict) { |
- return %DeleteProperty(%ToObject(this), %ToString(key), strict); |
+ return %DeleteProperty(%ToObject(this), %ToName(key), strict); |
} |
@@ -356,7 +356,7 @@ function IN(x) { |
throw %MakeTypeError('invalid_in_operator_use', [this, x]); |
} |
return %_IsNonNegativeSmi(this) ? |
- %HasElement(x, this) : %HasProperty(x, %ToString(this)); |
+ %HasElement(x, this) : %HasProperty(x, %ToName(this)); |
} |
@@ -396,7 +396,7 @@ function INSTANCE_OF(F) { |
// has a property with the given key; return the key as a string if |
// it has. Otherwise returns 0 (smi). Used in for-in statements. |
function FILTER_KEY(key) { |
- var string = %ToString(key); |
+ var string = %ToName(key); |
if (%HasProperty(this, string)) return string; |
return 0; |
} |
@@ -563,6 +563,12 @@ function NonStringToString(x) { |
} |
+// ES6 symbols |
+function ToName(x) { |
+ return IS_SYMBOL(x) ? x : %ToString(x); |
+} |
+ |
+ |
// ECMA-262, section 9.9, page 36. |
function ToObject(x) { |
if (IS_STRING(x)) return new $String(x); |