mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
LibJS: Remove Interpreter& argument to Function::construct()
This is no longer needed, we can get everything we need from the VM.
This commit is contained in:
parent
340a115dfe
commit
f79d4c7347
36 changed files with 73 additions and 61 deletions
|
@ -53,10 +53,10 @@ FunctionConstructor::~FunctionConstructor()
|
|||
|
||||
Value FunctionConstructor::call()
|
||||
{
|
||||
return construct(interpreter(), *this);
|
||||
return construct(*this);
|
||||
}
|
||||
|
||||
Value FunctionConstructor::construct(Interpreter& interpreter, Function&)
|
||||
Value FunctionConstructor::construct(Function&)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
String parameters_source = "";
|
||||
|
@ -88,7 +88,17 @@ Value FunctionConstructor::construct(Interpreter& interpreter, Function&)
|
|||
vm.throw_exception<SyntaxError>(global_object(), error.to_string());
|
||||
return {};
|
||||
}
|
||||
return function_expression->execute(interpreter, global_object());
|
||||
|
||||
OwnPtr<Interpreter> local_interpreter;
|
||||
Interpreter* interpreter = vm.interpreter_if_exists();
|
||||
|
||||
if (!interpreter) {
|
||||
local_interpreter = Interpreter::create_with_existing_global_object(global_object());
|
||||
interpreter = local_interpreter.ptr();
|
||||
}
|
||||
|
||||
VM::InterpreterExecutionScope scope(*interpreter);
|
||||
return function_expression->execute(*interpreter, global_object());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue