FunctionConstructor.h [plain text]
#pragma once
#include "InternalFunction.h"
namespace WTF {
class TextPosition;
}
namespace JSC {
class FunctionPrototype;
class FunctionConstructor : public InternalFunction {
public:
typedef InternalFunction Base;
static FunctionConstructor* create(VM& vm, Structure* structure, FunctionPrototype* functionPrototype)
{
FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(vm, structure);
constructor->finishCreation(vm, functionPrototype);
return constructor;
}
DECLARE_INFO;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
private:
FunctionConstructor(VM&, Structure*);
void finishCreation(VM&, FunctionPrototype*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
};
enum class FunctionConstructionMode {
Function,
Generator,
Async,
};
JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, const Identifier& functionName, const String& sourceURL, const WTF::TextPosition&, FunctionConstructionMode = FunctionConstructionMode::Function, JSValue newTarget = JSValue());
JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, FunctionConstructionMode = FunctionConstructionMode::Function, JSValue newTarget = JSValue());
JS_EXPORT_PRIVATE JSObject* constructFunctionSkippingEvalEnabledCheck(
ExecState*, JSGlobalObject*, const ArgList&, const Identifier&,
const String&, const WTF::TextPosition&, int overrideLineNumber = -1,
FunctionConstructionMode = FunctionConstructionMode::Function, JSValue newTarget = JSValue());
}