1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12: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:
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

@ -55,22 +55,23 @@ Value ProxyConstructor::call()
return {};
}
Value ProxyConstructor::construct(Interpreter& interpreter, Function&)
Value ProxyConstructor::construct(Function&)
{
if (interpreter.argument_count() < 2) {
interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::ProxyTwoArguments);
auto& vm = this->vm();
if (vm.argument_count() < 2) {
vm.throw_exception<TypeError>(global_object(), ErrorType::ProxyTwoArguments);
return {};
}
auto target = interpreter.argument(0);
auto handler = interpreter.argument(1);
auto target = vm.argument(0);
auto handler = vm.argument(1);
if (!target.is_object()) {
interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects().characters());
vm.throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects().characters());
return {};
}
if (!handler.is_object()) {
interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects().characters());
vm.throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects().characters());
return {};
}
return ProxyObject::create(global_object(), target.as_object(), handler.as_object());