mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibJS: Make run_executable() return simple ThrowCompletionOr<Value>
We don't need to return two values; running an executable only ever produces a throw completion, or a normal completion, i.e a Value. This necessitated a few minor changes, such as adding a way to check if a JS::Cell is a GeneratorResult.
This commit is contained in:
parent
2f7797f854
commit
5706831328
Notes:
github-actions[bot]
2025-10-31 07:57:15 +00:00
Author: https://github.com/awesomekling
Commit: 5706831328
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6648
10 changed files with 37 additions and 51 deletions
|
|
@ -743,11 +743,11 @@ ThrowCompletionOr<void> SourceTextModule::execute_module(VM& vm, GC::Ptr<Promise
|
|||
// c. Let result be the result of evaluating module.[[ECMAScriptCode]].
|
||||
Completion result;
|
||||
|
||||
auto result_and_return_register = vm.bytecode_interpreter().run_executable(*module_context, *executable, {});
|
||||
if (result_and_return_register.value.is_error()) {
|
||||
result = result_and_return_register.value.release_error();
|
||||
auto result_or_error = vm.bytecode_interpreter().run_executable(*module_context, *executable, {});
|
||||
if (result_or_error.is_error()) {
|
||||
result = result_or_error.release_error();
|
||||
} else {
|
||||
result = result_and_return_register.return_register_value.is_special_empty_value() ? js_undefined() : result_and_return_register.return_register_value;
|
||||
result = result_or_error.value().is_special_empty_value() ? js_undefined() : result_or_error.release_value();
|
||||
}
|
||||
|
||||
// d. Let env be moduleContext's LexicalEnvironment.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue