mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
LibJS: Convert Interpreter::run() to ThrowCompletionOr<Value>
Instead of making it a void function, checking for an exception, and then receiving the relevant result via VM::last_value(), we can consolidate all of this by using completions. This allows us to remove more uses of VM::exception(), and all uses of VM::last_value().
This commit is contained in:
parent
f73afbb5ae
commit
eb60d16549
13 changed files with 62 additions and 56 deletions
|
@ -342,11 +342,9 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path)
|
|||
JS::Bytecode::Interpreter bytecode_interpreter(interpreter->global_object(), interpreter->realm());
|
||||
MUST(bytecode_interpreter.run(executable));
|
||||
} else {
|
||||
interpreter->run(interpreter->global_object(), m_test_script->parse_node());
|
||||
MUST(interpreter->run(interpreter->global_object(), m_test_script->parse_node()));
|
||||
}
|
||||
|
||||
VERIFY(!g_vm->exception());
|
||||
|
||||
auto file_script = parse_script(test_path, interpreter->realm());
|
||||
if (file_script.is_error())
|
||||
return { test_path, file_script.error() };
|
||||
|
@ -358,7 +356,7 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path)
|
|||
JS::Bytecode::Interpreter bytecode_interpreter(interpreter->global_object(), interpreter->realm());
|
||||
(void)bytecode_interpreter.run(executable);
|
||||
} else {
|
||||
interpreter->run(interpreter->global_object(), file_script.value()->parse_node());
|
||||
(void)interpreter->run(interpreter->global_object(), file_script.value()->parse_node());
|
||||
}
|
||||
|
||||
if (g_vm->exception())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue