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
|
|
@ -823,7 +823,7 @@ void async_block_start(VM& vm, T const& async_body, PromiseCapability const& pro
|
|||
if (maybe_executable.is_error())
|
||||
result = maybe_executable.release_error();
|
||||
else
|
||||
result = vm.bytecode_interpreter().run_executable(vm.running_execution_context(), *maybe_executable.value(), {}).value;
|
||||
result = vm.bytecode_interpreter().run_executable(vm.running_execution_context(), *maybe_executable.value(), {});
|
||||
}
|
||||
// c. Else,
|
||||
else {
|
||||
|
|
@ -886,13 +886,7 @@ template void async_function_start(VM&, PromiseCapability const&, GC::Function<C
|
|||
// 15.8.4 Runtime Semantics: EvaluateAsyncFunctionBody, https://tc39.es/ecma262/#sec-runtime-semantics-evaluatefunctionbody
|
||||
ThrowCompletionOr<Value> ECMAScriptFunctionObject::ordinary_call_evaluate_body(VM& vm, ExecutionContext& context)
|
||||
{
|
||||
auto result_and_frame = vm.bytecode_interpreter().run_executable(context, *bytecode_executable(), {});
|
||||
|
||||
if (result_and_frame.value.is_error()) [[unlikely]] {
|
||||
return result_and_frame.value.release_error();
|
||||
}
|
||||
|
||||
auto result = result_and_frame.value.release_value();
|
||||
auto result = TRY(vm.bytecode_interpreter().run_executable(context, *bytecode_executable(), {}));
|
||||
|
||||
// NOTE: Running the bytecode should eventually return a completion.
|
||||
// Until it does, we assume "return" and include the undefined fallback from the call site.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue