diff options
author | Andreas Kling <kling@serenityos.org> | 2021-10-25 12:54:36 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-25 12:57:21 +0200 |
commit | a831cd9cc7c0562f98d0b7fb9a69056b132a64f7 (patch) | |
tree | 2ece2870f41c082e0d8d94a04c9fea1be0b871ea /Userland/Libraries | |
parent | 6fc3c14b7ab67d492819cb57fd88f45b6b4abf03 (diff) | |
download | serenity-a831cd9cc7c0562f98d0b7fb9a69056b132a64f7.zip |
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().
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 49855b1f38..d6b927caa6 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/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(); |