1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibJS: Remove GlobalObject& argument from VM::construct()

We can just get the global object from the constructor function.
This commit is contained in:
Andreas Kling 2021-06-10 23:17:29 +02:00
parent f5feb1d2cd
commit 93a07ba962
6 changed files with 9 additions and 8 deletions

View file

@ -222,7 +222,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj
Object* new_object = nullptr;
Value result;
if (is<NewExpression>(*this)) {
result = vm.construct(function, function, move(arguments), global_object);
result = vm.construct(function, function, move(arguments));
if (result.is_object())
new_object = &result.as_object();
} else if (is<SuperExpression>(*m_callee)) {
@ -239,7 +239,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj
vm.throw_exception<TypeError>(global_object, ErrorType::NotAConstructor, "Super constructor");
return {};
}
result = vm.construct(static_cast<Function&>(*super_constructor), function, move(arguments), global_object);
result = vm.construct(static_cast<Function&>(*super_constructor), function, move(arguments));
if (vm.exception())
return {};