mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +00:00
LibJS: Convert AggregateError::create() to NonnullGCPtr
This commit is contained in:
parent
2b92c15b34
commit
0c50751c13
4 changed files with 6 additions and 6 deletions
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AggregateError* AggregateError::create(Realm& realm)
|
NonnullGCPtr<AggregateError> AggregateError::create(Realm& realm)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<AggregateError>(realm, *realm.intrinsics().aggregate_error_prototype());
|
return *realm.heap().allocate<AggregateError>(realm, *realm.intrinsics().aggregate_error_prototype());
|
||||||
}
|
}
|
||||||
|
|
||||||
AggregateError::AggregateError(Object& prototype)
|
AggregateError::AggregateError(Object& prototype)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@ class AggregateError : public Error {
|
||||||
JS_OBJECT(AggregateError, Error);
|
JS_OBJECT(AggregateError, Error);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static AggregateError* create(Realm&);
|
static NonnullGCPtr<AggregateError> create(Realm&);
|
||||||
virtual ~AggregateError() override = default;
|
virtual ~AggregateError() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -198,7 +198,7 @@ static ThrowCompletionOr<Value> perform_promise_any(VM& vm, Iterator& iterator_r
|
||||||
vm, iterator_record, constructor, result_capability, promise_resolve,
|
vm, iterator_record, constructor, result_capability, promise_resolve,
|
||||||
[&](PromiseValueList& errors) -> ThrowCompletionOr<Value> {
|
[&](PromiseValueList& errors) -> ThrowCompletionOr<Value> {
|
||||||
// 1. Let error be a newly created AggregateError object.
|
// 1. Let error be a newly created AggregateError object.
|
||||||
auto* error = AggregateError::create(realm);
|
auto error = AggregateError::create(realm);
|
||||||
|
|
||||||
// 2. Perform ! DefinePropertyOrThrow(error, "errors", PropertyDescriptor { [[Configurable]]: true, [[Enumerable]]: false, [[Writable]]: true, [[Value]]: CreateArrayFromList(errors) }).
|
// 2. Perform ! DefinePropertyOrThrow(error, "errors", PropertyDescriptor { [[Configurable]]: true, [[Enumerable]]: false, [[Writable]]: true, [[Value]]: CreateArrayFromList(errors) }).
|
||||||
auto* errors_array = Array::create_from(realm, errors.values());
|
auto* errors_array = Array::create_from(realm, errors.values());
|
||||||
|
|
|
@ -189,7 +189,7 @@ ThrowCompletionOr<Value> PromiseAnyRejectElementFunction::resolve_element()
|
||||||
// 10. If remainingElementsCount.[[Value]] is 0, then
|
// 10. If remainingElementsCount.[[Value]] is 0, then
|
||||||
if (--m_remaining_elements.value == 0) {
|
if (--m_remaining_elements.value == 0) {
|
||||||
// a. Let error be a newly created AggregateError object.
|
// a. Let error be a newly created AggregateError object.
|
||||||
auto* error = AggregateError::create(realm);
|
auto error = AggregateError::create(realm);
|
||||||
|
|
||||||
// b. Perform ! DefinePropertyOrThrow(error, "errors", PropertyDescriptor { [[Configurable]]: true, [[Enumerable]]: false, [[Writable]]: true, [[Value]]: CreateArrayFromList(errors) }).
|
// b. Perform ! DefinePropertyOrThrow(error, "errors", PropertyDescriptor { [[Configurable]]: true, [[Enumerable]]: false, [[Writable]]: true, [[Value]]: CreateArrayFromList(errors) }).
|
||||||
auto* errors_array = Array::create_from(realm, m_values.values());
|
auto* errors_array = Array::create_from(realm, m_values.values());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue