1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

LibJS: Make bytecode VM throw TypeError on attempt to call non-callable

This isn't perfect, but allows us to progress instead of crashing in
the TODO().
This commit is contained in:
Andreas Kling 2021-10-25 12:54:36 +02:00
parent 6fc3c14b7a
commit a831cd9cc7

View file

@ -350,7 +350,8 @@ void Call::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto callee = interpreter.reg(m_callee);
if (!callee.is_function()) {
TODO();
interpreter.vm().throw_exception<TypeError>(interpreter.global_object(), ErrorType::IsNotA, callee.to_string_without_side_effects(), "function"sv);
return;
}
auto& function = callee.as_function();