AsyncFunctionConstructor.cpp [plain text]
#include "config.h"
#include "AsyncFunctionConstructor.h"
#include "AsyncFunctionPrototype.h"
#include "FunctionConstructor.h"
#include "JSCInlines.h"
namespace JSC {
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(AsyncFunctionConstructor);
const ClassInfo AsyncFunctionConstructor::s_info = { "AsyncFunction", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(AsyncFunctionConstructor) };
static JSC_DECLARE_HOST_FUNCTION(callAsyncFunctionConstructor);
static JSC_DECLARE_HOST_FUNCTION(constructAsyncFunctionConstructor);
JSC_DEFINE_HOST_FUNCTION(callAsyncFunctionConstructor, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
ArgList args(callFrame);
return JSValue::encode(constructFunction(globalObject, callFrame, args, FunctionConstructionMode::Async));
}
JSC_DEFINE_HOST_FUNCTION(constructAsyncFunctionConstructor, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
ArgList args(callFrame);
return JSValue::encode(constructFunction(globalObject, callFrame, args, FunctionConstructionMode::Async, callFrame->newTarget()));
}
AsyncFunctionConstructor::AsyncFunctionConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure, callAsyncFunctionConstructor, constructAsyncFunctionConstructor)
{
}
void AsyncFunctionConstructor::finishCreation(VM& vm, AsyncFunctionPrototype* prototype)
{
Base::finishCreation(vm, 1, "AsyncFunction"_s, PropertyAdditionMode::WithoutStructureTransition);
putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
}
}