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();
|
return js_undefined();
|
||||||
}
|
}
|
||||||
already_resolved.value = true;
|
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) {
|
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);
|
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");
|
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)
|
if (already_resolved.value)
|
||||||
return js_undefined();
|
return js_undefined();
|
||||||
already_resolved.value = true;
|
already_resolved.value = true;
|
||||||
auto reason = vm.argument(0).value_or(js_undefined());
|
auto reason = vm.argument(0);
|
||||||
return promise.reject(reason);
|
return promise.reject(reason);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue