diff options
author | Linus Groh <mail@linusgroh.de> | 2022-01-04 22:04:22 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-04 23:37:26 +0000 |
commit | 245d486ba4f255a85c52579e8654bac7861d8365 (patch) | |
tree | 972a2d2bfb6a7da0e8db5c9cef3f8d97a2dfc9a0 | |
parent | b4208c8ea17ab98d48bab336871c9030b7aa927e (diff) | |
download | serenity-245d486ba4f255a85c52579e8654bac7861d8365.zip |
LibJS: Convert PromiseResolvingElementFunction to ThrowCompletionOr
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h | 10 |
2 files changed, 13 insertions, 13 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp index 0860b1802f..aeb205dac3 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp @@ -58,7 +58,7 @@ PromiseAllResolveElementFunction::PromiseAllResolveElementFunction(size_t index, { } -Value PromiseAllResolveElementFunction::resolve_element() +ThrowCompletionOr<Value> PromiseAllResolveElementFunction::resolve_element() { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -73,7 +73,7 @@ Value PromiseAllResolveElementFunction::resolve_element() auto* values_array = Array::create_from(global_object, m_values.values()); // b. Return ? Call(promiseCapability.[[Resolve]], undefined, « valuesArray »). - return TRY_OR_DISCARD(vm.call(*m_capability.resolve, js_undefined(), values_array)); + return vm.call(*m_capability.resolve, js_undefined(), values_array); } // 11. Return undefined. @@ -90,7 +90,7 @@ PromiseAllSettledResolveElementFunction::PromiseAllSettledResolveElementFunction { } -Value PromiseAllSettledResolveElementFunction::resolve_element() +ThrowCompletionOr<Value> PromiseAllSettledResolveElementFunction::resolve_element() { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -114,7 +114,7 @@ Value PromiseAllSettledResolveElementFunction::resolve_element() auto* values_array = Array::create_from(global_object, m_values.values()); // b. Return ? Call(promiseCapability.[[Resolve]], undefined, « valuesArray »). - return TRY_OR_DISCARD(vm.call(*m_capability.resolve, js_undefined(), values_array)); + return vm.call(*m_capability.resolve, js_undefined(), values_array); } // 15. Return undefined. @@ -131,7 +131,7 @@ PromiseAllSettledRejectElementFunction::PromiseAllSettledRejectElementFunction(s { } -Value PromiseAllSettledRejectElementFunction::resolve_element() +ThrowCompletionOr<Value> PromiseAllSettledRejectElementFunction::resolve_element() { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -155,7 +155,7 @@ Value PromiseAllSettledRejectElementFunction::resolve_element() auto values_array = Array::create_from(global_object, m_values.values()); // b. Return ? Call(promiseCapability.[[Resolve]], undefined, « valuesArray »). - return TRY_OR_DISCARD(vm.call(*m_capability.resolve, js_undefined(), values_array)); + return vm.call(*m_capability.resolve, js_undefined(), values_array); } // 15. Return undefined. @@ -172,7 +172,7 @@ PromiseAnyRejectElementFunction::PromiseAnyRejectElementFunction(size_t index, P { } -Value PromiseAnyRejectElementFunction::resolve_element() +ThrowCompletionOr<Value> PromiseAnyRejectElementFunction::resolve_element() { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -191,7 +191,7 @@ Value PromiseAnyRejectElementFunction::resolve_element() MUST(error->define_property_or_throw(vm.names.errors, { .value = errors_array, .writable = true, .enumerable = false, .configurable = true })); // c. Return ? Call(promiseCapability.[[Reject]], undefined, « error »). - return TRY_OR_DISCARD(vm.call(*m_capability.reject, js_undefined(), error)); + return vm.call(*m_capability.reject, js_undefined(), error); } return js_undefined(); diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h index 0c56aeae0a..81197dfb07 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h +++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h @@ -51,7 +51,7 @@ public: protected: explicit PromiseResolvingElementFunction(size_t, PromiseValueList&, PromiseCapability, RemainingElements&, Object& prototype); - virtual Value resolve_element() = 0; + virtual ThrowCompletionOr<Value> resolve_element() = 0; size_t m_index { 0 }; PromiseValueList& m_values; @@ -75,7 +75,7 @@ public: virtual ~PromiseAllResolveElementFunction() override = default; private: - virtual Value resolve_element() override; + virtual ThrowCompletionOr<Value> resolve_element() override; }; // 27.2.4.2.2 Promise.allSettled Resolve Element Functions, https://tc39.es/ecma262/#sec-promise.allsettled-resolve-element-functions @@ -89,7 +89,7 @@ public: virtual ~PromiseAllSettledResolveElementFunction() override = default; private: - virtual Value resolve_element() override; + virtual ThrowCompletionOr<Value> resolve_element() override; }; // 27.2.4.2.3 Promise.allSettled Reject Element Functions, https://tc39.es/ecma262/#sec-promise.allsettled-reject-element-functions @@ -103,7 +103,7 @@ public: virtual ~PromiseAllSettledRejectElementFunction() override = default; private: - virtual Value resolve_element() override; + virtual ThrowCompletionOr<Value> resolve_element() override; }; // 27.2.4.3.2 Promise.any Reject Element Functions, https://tc39.es/ecma262/#sec-promise.any-reject-element-functions @@ -117,7 +117,7 @@ public: virtual ~PromiseAnyRejectElementFunction() override = default; private: - virtual Value resolve_element() override; + virtual ThrowCompletionOr<Value> resolve_element() override; }; } |