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 EncodedJSValue JSC_HOST_CALL callAsyncFunctionConstructor(ExecState* exec)
{
ArgList args(exec);
return JSValue::encode(constructFunction(exec, jsCast<InternalFunction*>(exec->jsCallee())->globalObject(exec->vm()), args, FunctionConstructionMode::Async));
}
static EncodedJSValue JSC_HOST_CALL constructAsyncFunctionConstructor(ExecState* exec)
{
ArgList args(exec);
return JSValue::encode(constructFunction(exec, jsCast<InternalFunction*>(exec->jsCallee())->globalObject(exec->vm()), args, FunctionConstructionMode::Async));
}
AsyncFunctionConstructor::AsyncFunctionConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure, callAsyncFunctionConstructor, constructAsyncFunctionConstructor)
{
}
void AsyncFunctionConstructor::finishCreation(VM& vm, AsyncFunctionPrototype* prototype)
{
Base::finishCreation(vm, "AsyncFunction");
putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
}
}