IntlDisplayNamesPrototype.cpp [plain text]
#include "config.h"
#include "IntlDisplayNamesPrototype.h"
#include "IntlDisplayNames.h"
#include "JSCInlines.h"
namespace JSC {
static JSC_DECLARE_HOST_FUNCTION(IntlDisplayNamesPrototypeFuncOf);
static JSC_DECLARE_HOST_FUNCTION(IntlDisplayNamesPrototypeFuncResolvedOptions);
}
#include "IntlDisplayNamesPrototype.lut.h"
namespace JSC {
const ClassInfo IntlDisplayNamesPrototype::s_info = { "Intl.DisplayNames", &Base::s_info, &displayNamesPrototypeTable, nullptr, CREATE_METHOD_TABLE(IntlDisplayNamesPrototype) };
IntlDisplayNamesPrototype* IntlDisplayNamesPrototype::create(VM& vm, Structure* structure)
{
auto* object = new (NotNull, allocateCell<IntlDisplayNamesPrototype>(vm.heap)) IntlDisplayNamesPrototype(vm, structure);
object->finishCreation(vm);
return object;
}
Structure* IntlDisplayNamesPrototype::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
IntlDisplayNamesPrototype::IntlDisplayNamesPrototype(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
void IntlDisplayNamesPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
}
JSC_DEFINE_HOST_FUNCTION(IntlDisplayNamesPrototypeFuncOf, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto* displayNames = jsDynamicCast<IntlDisplayNames*>(vm, callFrame->thisValue());
if (!displayNames)
return throwVMTypeError(globalObject, scope, "Intl.DisplayNames.prototype.of called on value that's not an object initialized as a DisplayNames"_s);
RELEASE_AND_RETURN(scope, JSValue::encode(displayNames->of(globalObject, callFrame->argument(0))));
}
JSC_DEFINE_HOST_FUNCTION(IntlDisplayNamesPrototypeFuncResolvedOptions, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto* displayNames = jsDynamicCast<IntlDisplayNames*>(vm, callFrame->thisValue());
if (!displayNames)
return throwVMTypeError(globalObject, scope, "Intl.DisplayNames.prototype.resolvedOptions called on value that's not an object initialized as a DisplayNames"_s);
RELEASE_AND_RETURN(scope, JSValue::encode(displayNames->resolvedOptions(globalObject)));
}
}