IntlSegmentsPrototype.cpp [plain text]
#include "config.h"
#include "IntlSegmentsPrototype.h"
#include "IntlSegments.h"
#include "JSCInlines.h"
namespace JSC {
static JSC_DECLARE_HOST_FUNCTION(IntlSegmentsPrototypeFuncContaining);
static JSC_DECLARE_HOST_FUNCTION(IntlSegmentsPrototypeFuncIterator);
}
#include "IntlSegmentsPrototype.lut.h"
namespace JSC {
const ClassInfo IntlSegmentsPrototype::s_info = { "%Segments%", &Base::s_info, &segmentsPrototypeTable, nullptr, CREATE_METHOD_TABLE(IntlSegmentsPrototype) };
IntlSegmentsPrototype* IntlSegmentsPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
auto* object = new (NotNull, allocateCell<IntlSegmentsPrototype>(vm.heap)) IntlSegmentsPrototype(vm, structure);
object->finishCreation(vm, globalObject);
return object;
}
Structure* IntlSegmentsPrototype::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
IntlSegmentsPrototype::IntlSegmentsPrototype(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
void IntlSegmentsPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->iteratorSymbol, IntlSegmentsPrototypeFuncIterator, static_cast<unsigned>(PropertyAttribute::DontEnum), 0);
}
JSC_DEFINE_HOST_FUNCTION(IntlSegmentsPrototypeFuncContaining, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto* segments = jsDynamicCast<IntlSegments*>(vm, callFrame->thisValue());
if (!segments)
return throwVMTypeError(globalObject, scope, "%Segments.prototype%.containing called on value that's not an object initialized as a Segments"_s);
RELEASE_AND_RETURN(scope, JSValue::encode(segments->containing(globalObject, callFrame->argument(0))));
}
JSC_DEFINE_HOST_FUNCTION(IntlSegmentsPrototypeFuncIterator, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto* segments = jsDynamicCast<IntlSegments*>(vm, callFrame->thisValue());
if (!segments)
return throwVMTypeError(globalObject, scope, "%Segments.prototype%[@@iterator] called on value that's not an object initialized as a Segments"_s);
RELEASE_AND_RETURN(scope, JSValue::encode(segments->createSegmentIterator(globalObject)));
}
}