LibJS: Make Completion.[[Value]] non-optional

Instead, just use js_undefined() whenever the [[Value]] field is unused.
This avoids a whole bunch of presence checks.
This commit is contained in:
Andreas Kling 2025-04-04 18:11:45 +02:00 committed by Andreas Kling
commit de424d6879
Notes: github-actions[bot] 2025-04-05 09:21:48 +00:00
65 changed files with 225 additions and 250 deletions

View file

@ -282,7 +282,7 @@ ThrowCompletionOr<GC::Ref<Object>> PromiseConstructor::construct(FunctionObject&
// 10. If completion is an abrupt completion, then
if (completion.is_error()) {
// a. Perform ? Call(resolvingFunctions.[[Reject]], undefined, « completion.[[Value]] »).
TRY(JS::call(vm, *reject_function, js_undefined(), *completion.release_error().value()));
TRY(JS::call(vm, *reject_function, js_undefined(), completion.release_error().value()));
}
// 11. Return promise.
@ -484,7 +484,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::try_)
// 5. If status is an abrupt completion, then
if (status.is_throw_completion()) {
// a. Perform ? Call(promiseCapability.[[Reject]], undefined, « status.[[Value]] »).
TRY(JS::call(vm, *promise_capability->reject(), js_undefined(), *status.throw_completion().value()));
TRY(JS::call(vm, *promise_capability->reject(), js_undefined(), status.throw_completion().value()));
}
// 6. Else,
else {