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