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
|
|
@ -36,15 +36,10 @@ public:
|
|||
|
||||
ThrowCompletionOr<Value> run(ExecutionContext& context, Executable& executable, Optional<size_t> entry_point = {}, Value initial_accumulator_value = js_special_empty_value())
|
||||
{
|
||||
auto result_and_return_register = run_executable(context, executable, entry_point, initial_accumulator_value);
|
||||
return move(result_and_return_register.value);
|
||||
return run_executable(context, executable, entry_point, initial_accumulator_value);
|
||||
}
|
||||
|
||||
struct ResultAndReturnRegister {
|
||||
ThrowCompletionOr<Value> value;
|
||||
Value return_register_value;
|
||||
};
|
||||
ResultAndReturnRegister run_executable(ExecutionContext&, Executable&, Optional<size_t> entry_point, Value initial_accumulator_value = js_special_empty_value());
|
||||
ThrowCompletionOr<Value> run_executable(ExecutionContext&, Executable&, Optional<size_t> entry_point, Value initial_accumulator_value = js_special_empty_value());
|
||||
|
||||
ALWAYS_INLINE Value& accumulator() { return reg(Register::accumulator()); }
|
||||
ALWAYS_INLINE Value& saved_return_value() { return reg(Register::saved_return_value()); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue