mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibJS: Remove two unnecessary 'vm.argument(0).value_or(js_undefined())'
VM::argument() never returns an empty value.
This commit is contained in:
parent
fdf701ed96
commit
57f7e6e775
Notes:
sideshowbarker
2024-07-18 10:25:43 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/57f7e6e7755 Pull-request: https://github.com/SerenityOS/serenity/pull/8442 Reviewed-by: https://github.com/IdanHo ✅
1 changed files with 2 additions and 2 deletions
|
@ -63,7 +63,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
|
|||
return js_undefined();
|
||||
}
|
||||
already_resolved.value = true;
|
||||
auto resolution = vm.argument(0).value_or(js_undefined());
|
||||
auto resolution = vm.argument(0);
|
||||
if (resolution.is_object() && &resolution.as_object() == &promise) {
|
||||
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / PromiseResolvingFunction]: Promise can't be resolved with itself, rejecting with error", &promise);
|
||||
auto* self_resolution_error = TypeError::create(global_object, "Cannot resolve promise with itself");
|
||||
|
@ -100,7 +100,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
|
|||
if (already_resolved.value)
|
||||
return js_undefined();
|
||||
already_resolved.value = true;
|
||||
auto reason = vm.argument(0).value_or(js_undefined());
|
||||
auto reason = vm.argument(0);
|
||||
return promise.reject(reason);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue