1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +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:
Andreas Kling 2020-09-27 18:45:21 +02:00
parent 340a115dfe
commit f79d4c7347
36 changed files with 73 additions and 61 deletions

View file

@ -49,15 +49,16 @@ ErrorConstructor::~ErrorConstructor()
Value ErrorConstructor::call()
{
return construct(interpreter(), *this);
return construct(*this);
}
Value ErrorConstructor::construct(Interpreter& interpreter, Function&)
Value ErrorConstructor::construct(Function&)
{
auto& vm = this->vm();
String message = "";
if (!interpreter.call_frame().arguments.is_empty() && !interpreter.call_frame().arguments[0].is_undefined()) {
message = interpreter.call_frame().arguments[0].to_string(global_object());
if (interpreter.exception())
if (!vm.call_frame().arguments.is_empty() && !vm.call_frame().arguments[0].is_undefined()) {
message = vm.call_frame().arguments[0].to_string(global_object());
if (vm.exception())
return {};
}
return Error::create(global_object(), "Error", message);
@ -77,9 +78,9 @@ Value ErrorConstructor::construct(Interpreter& interpreter, Function&)
ConstructorName::~ConstructorName() { } \
Value ConstructorName::call() \
{ \
return construct(interpreter(), *this); \
return construct(*this); \
} \
Value ConstructorName::construct(Interpreter&, Function&) \
Value ConstructorName::construct(Function&) \
{ \
String message = ""; \
if (!vm().call_frame().arguments.is_empty() && !vm().call_frame().arguments[0].is_undefined()) { \