Bläddra i källkod

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().
Andreas Kling 3 år sedan
förälder
incheckning
a831cd9cc7
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      Userland/Libraries/LibJS/Bytecode/Op.cpp

+ 2 - 1
Userland/Libraries/LibJS/Bytecode/Op.cpp

@@ -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();