X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/81345200c95645a1b0d2635520f96ad55dfde63f..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/runtime/JSCell.cpp?ds=inline diff --git a/runtime/JSCell.cpp b/runtime/JSCell.cpp index 84349fe..2c403c8 100644 --- a/runtime/JSCell.cpp +++ b/runtime/JSCell.cpp @@ -96,7 +96,7 @@ ConstructType JSCell::getConstructData(JSCell*, ConstructData& constructData) void JSCell::put(JSCell* cell, ExecState* exec, PropertyName identifier, JSValue value, PutPropertySlot& slot) { - if (cell->isString()) { + if (cell->isString() || cell->isSymbol()) { JSValue(cell).putToPrimitive(exec, identifier, value, slot); return; } @@ -106,7 +106,7 @@ void JSCell::put(JSCell* cell, ExecState* exec, PropertyName identifier, JSValue void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSValue value, bool shouldThrow) { - if (cell->isString()) { + if (cell->isString() || cell->isSymbol()) { PutPropertySlot slot(cell, shouldThrow); JSValue(cell).putToPrimitive(exec, Identifier::from(exec, identifier), value, slot); return; @@ -138,6 +138,8 @@ JSValue JSCell::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredTyp { if (isString()) return static_cast(this)->toPrimitive(exec, preferredType); + if (isSymbol()) + return static_cast(this)->toPrimitive(exec, preferredType); return static_cast(this)->toPrimitive(exec, preferredType); } @@ -145,6 +147,8 @@ bool JSCell::getPrimitiveNumber(ExecState* exec, double& number, JSValue& value) { if (isString()) return static_cast(this)->getPrimitiveNumber(exec, number, value); + if (isSymbol()) + return static_cast(this)->getPrimitiveNumber(exec, number, value); return static_cast(this)->getPrimitiveNumber(exec, number, value); } @@ -152,6 +156,8 @@ double JSCell::toNumber(ExecState* exec) const { if (isString()) return static_cast(this)->toNumber(exec); + if (isSymbol()) + return static_cast(this)->toNumber(exec); return static_cast(this)->toNumber(exec); } @@ -159,6 +165,8 @@ JSObject* JSCell::toObject(ExecState* exec, JSGlobalObject* globalObject) const { if (isString()) return static_cast(this)->toObject(exec, globalObject); + if (isSymbol()) + return static_cast(this)->toObject(exec, globalObject); ASSERT(isObject()); return jsCast(const_cast(this)); } @@ -236,4 +244,20 @@ PassRefPtr JSCell::getTypedArrayImpl(JSArrayBufferView*) return 0; } +uint32_t JSCell::getEnumerableLength(ExecState*, JSObject*) +{ + RELEASE_ASSERT_NOT_REACHED(); + return 0; +} + +void JSCell::getStructurePropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode) +{ + RELEASE_ASSERT_NOT_REACHED(); +} + +void JSCell::getGenericPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode) +{ + RELEASE_ASSERT_NOT_REACHED(); +} + } // namespace JSC