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:
Andreas Kling 2025-10-30 10:27:47 +01:00 committed by Andreas Kling
parent 2f7797f854
commit 5706831328
Notes: github-actions[bot] 2025-10-31 07:57:15 +00:00
10 changed files with 37 additions and 51 deletions

View file

@ -735,11 +735,7 @@ ThrowCompletionOr<Value> perform_eval(VM& vm, Value x, CallerMode strict_caller,
Optional<Value> eval_result;
auto result_or_error = vm.bytecode_interpreter().run_executable(*eval_context, *executable, {});
if (result_or_error.value.is_error())
return result_or_error.value.release_error();
eval_result = result_or_error.return_register_value;
eval_result = TRY(vm.bytecode_interpreter().run_executable(*eval_context, *executable, {}));
// 32. If result.[[Type]] is normal and result.[[Value]] is empty, then
// a. Set result to NormalCompletion(undefined).