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