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) };
AsyncFunctionConstructor::AsyncFunctionConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
{
}
void AsyncFunctionConstructor::finishCreation(VM& vm, AsyncFunctionPrototype* prototype)
{
Base::finishCreation(vm, "AsyncFunction");
putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
}
static EncodedJSValue JSC_HOST_CALL callAsyncFunctionConstructor(ExecState* exec)
{
ArgList args(exec);
return JSValue::encode(constructFunction(exec, asInternalFunction(exec->jsCallee())->globalObject(), args, FunctionConstructionMode::Async));
}
static EncodedJSValue JSC_HOST_CALL constructAsyncFunctionConstructor(ExecState* exec)
{
ArgList args(exec);
return JSValue::encode(constructFunction(exec, asInternalFunction(exec->jsCallee())->globalObject(), args, FunctionConstructionMode::Async));
}
CallType AsyncFunctionConstructor::getCallData(JSCell*, CallData& callData)
{
callData.native.function = callAsyncFunctionConstructor;
return CallType::Host;
}
ConstructType AsyncFunctionConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructAsyncFunctionConstructor;
return ConstructType::Host;
}
}