mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02: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:
Notes:
sideshowbarker
2024-07-17 21:24:22 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/eb60d16549e Pull-request: https://github.com/SerenityOS/serenity/pull/11740 Reviewed-by: https://github.com/awesomekling ✅
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user