mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibJS: Convert PromiseFooElementFunction::create() to NonnullGCPtr
This commit is contained in:
parent
716c8bdc9d
commit
d3cb7cd584
3 changed files with 16 additions and 16 deletions
|
@ -138,7 +138,7 @@ static ThrowCompletionOr<Value> perform_promise_all(VM& vm, Iterator& iterator_r
|
||||||
// o. Set onFulfilled.[[Values]] to values.
|
// o. Set onFulfilled.[[Values]] to values.
|
||||||
// p. Set onFulfilled.[[Capability]] to resultCapability.
|
// p. Set onFulfilled.[[Capability]] to resultCapability.
|
||||||
// q. Set onFulfilled.[[RemainingElements]] to remainingElementsCount.
|
// q. Set onFulfilled.[[RemainingElements]] to remainingElementsCount.
|
||||||
auto* on_fulfilled = PromiseAllResolveElementFunction::create(realm, index, values, result_capability, remaining_elements_count);
|
auto on_fulfilled = PromiseAllResolveElementFunction::create(realm, index, values, result_capability, remaining_elements_count);
|
||||||
on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
||||||
|
|
||||||
// s. Perform ? Invoke(nextPromise, "then", « onFulfilled, resultCapability.[[Reject]] »).
|
// s. Perform ? Invoke(nextPromise, "then", « onFulfilled, resultCapability.[[Reject]] »).
|
||||||
|
@ -170,7 +170,7 @@ static ThrowCompletionOr<Value> perform_promise_all_settled(VM& vm, Iterator& it
|
||||||
// p. Set onFulfilled.[[Values]] to values.
|
// p. Set onFulfilled.[[Values]] to values.
|
||||||
// q. Set onFulfilled.[[Capability]] to resultCapability.
|
// q. Set onFulfilled.[[Capability]] to resultCapability.
|
||||||
// r. Set onFulfilled.[[RemainingElements]] to remainingElementsCount.
|
// r. Set onFulfilled.[[RemainingElements]] to remainingElementsCount.
|
||||||
auto* on_fulfilled = PromiseAllSettledResolveElementFunction::create(realm, index, values, result_capability, remaining_elements_count);
|
auto on_fulfilled = PromiseAllSettledResolveElementFunction::create(realm, index, values, result_capability, remaining_elements_count);
|
||||||
on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
||||||
|
|
||||||
// s. Let stepsRejected be the algorithm steps defined in Promise.allSettled Reject Element Functions.
|
// s. Let stepsRejected be the algorithm steps defined in Promise.allSettled Reject Element Functions.
|
||||||
|
@ -181,7 +181,7 @@ static ThrowCompletionOr<Value> perform_promise_all_settled(VM& vm, Iterator& it
|
||||||
// x. Set onRejected.[[Values]] to values.
|
// x. Set onRejected.[[Values]] to values.
|
||||||
// y. Set onRejected.[[Capability]] to resultCapability.
|
// y. Set onRejected.[[Capability]] to resultCapability.
|
||||||
// z. Set onRejected.[[RemainingElements]] to remainingElementsCount.
|
// z. Set onRejected.[[RemainingElements]] to remainingElementsCount.
|
||||||
auto* on_rejected = PromiseAllSettledRejectElementFunction::create(realm, index, values, result_capability, remaining_elements_count);
|
auto on_rejected = PromiseAllSettledRejectElementFunction::create(realm, index, values, result_capability, remaining_elements_count);
|
||||||
on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
||||||
|
|
||||||
// ab. Perform ? Invoke(nextPromise, "then", « onFulfilled, onRejected »).
|
// ab. Perform ? Invoke(nextPromise, "then", « onFulfilled, onRejected »).
|
||||||
|
@ -216,7 +216,7 @@ static ThrowCompletionOr<Value> perform_promise_any(VM& vm, Iterator& iterator_r
|
||||||
// o. Set onRejected.[[Errors]] to errors.
|
// o. Set onRejected.[[Errors]] to errors.
|
||||||
// p. Set onRejected.[[Capability]] to resultCapability.
|
// p. Set onRejected.[[Capability]] to resultCapability.
|
||||||
// q. Set onRejected.[[RemainingElements]] to remainingElementsCount.
|
// q. Set onRejected.[[RemainingElements]] to remainingElementsCount.
|
||||||
auto* on_rejected = PromiseAnyRejectElementFunction::create(realm, index, errors, result_capability, remaining_elements_count);
|
auto on_rejected = PromiseAnyRejectElementFunction::create(realm, index, errors, result_capability, remaining_elements_count);
|
||||||
on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable);
|
||||||
|
|
||||||
// s. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], onRejected »).
|
// s. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], onRejected »).
|
||||||
|
|
|
@ -53,9 +53,9 @@ void PromiseResolvingElementFunction::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(&m_remaining_elements);
|
visitor.visit(&m_remaining_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAllResolveElementFunction* PromiseAllResolveElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
NonnullGCPtr<PromiseAllResolveElementFunction> PromiseAllResolveElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<PromiseAllResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
return *realm.heap().allocate<PromiseAllResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAllResolveElementFunction::PromiseAllResolveElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
PromiseAllResolveElementFunction::PromiseAllResolveElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
||||||
|
@ -85,9 +85,9 @@ ThrowCompletionOr<Value> PromiseAllResolveElementFunction::resolve_element()
|
||||||
return js_undefined();
|
return js_undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAllSettledResolveElementFunction* PromiseAllSettledResolveElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
NonnullGCPtr<PromiseAllSettledResolveElementFunction> PromiseAllSettledResolveElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<PromiseAllSettledResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
return *realm.heap().allocate<PromiseAllSettledResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAllSettledResolveElementFunction::PromiseAllSettledResolveElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
PromiseAllSettledResolveElementFunction::PromiseAllSettledResolveElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
||||||
|
@ -126,9 +126,9 @@ ThrowCompletionOr<Value> PromiseAllSettledResolveElementFunction::resolve_elemen
|
||||||
return js_undefined();
|
return js_undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAllSettledRejectElementFunction* PromiseAllSettledRejectElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
NonnullGCPtr<PromiseAllSettledRejectElementFunction> PromiseAllSettledRejectElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<PromiseAllSettledRejectElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
return *realm.heap().allocate<PromiseAllSettledRejectElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAllSettledRejectElementFunction::PromiseAllSettledRejectElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
PromiseAllSettledRejectElementFunction::PromiseAllSettledRejectElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
||||||
|
@ -167,9 +167,9 @@ ThrowCompletionOr<Value> PromiseAllSettledRejectElementFunction::resolve_element
|
||||||
return js_undefined();
|
return js_undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAnyRejectElementFunction* PromiseAnyRejectElementFunction::create(Realm& realm, size_t index, PromiseValueList& errors, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
NonnullGCPtr<PromiseAnyRejectElementFunction> PromiseAnyRejectElementFunction::create(Realm& realm, size_t index, PromiseValueList& errors, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<PromiseAnyRejectElementFunction>(realm, index, errors, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
return *realm.heap().allocate<PromiseAnyRejectElementFunction>(realm, index, errors, capability, remaining_elements, *realm.intrinsics().function_prototype());
|
||||||
}
|
}
|
||||||
|
|
||||||
PromiseAnyRejectElementFunction::PromiseAnyRejectElementFunction(size_t index, PromiseValueList& errors, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
PromiseAnyRejectElementFunction::PromiseAnyRejectElementFunction(size_t index, PromiseValueList& errors, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
|
||||||
|
|
|
@ -71,7 +71,7 @@ class PromiseAllResolveElementFunction final : public PromiseResolvingElementFun
|
||||||
JS_OBJECT(PromiseResolvingFunction, NativeFunction);
|
JS_OBJECT(PromiseResolvingFunction, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PromiseAllResolveElementFunction* create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
static NonnullGCPtr<PromiseAllResolveElementFunction> create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
||||||
|
|
||||||
virtual ~PromiseAllResolveElementFunction() override = default;
|
virtual ~PromiseAllResolveElementFunction() override = default;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class PromiseAllSettledResolveElementFunction final : public PromiseResolvingEle
|
||||||
JS_OBJECT(PromiseResolvingFunction, NativeFunction);
|
JS_OBJECT(PromiseResolvingFunction, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PromiseAllSettledResolveElementFunction* create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
static NonnullGCPtr<PromiseAllSettledResolveElementFunction> create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
||||||
|
|
||||||
virtual ~PromiseAllSettledResolveElementFunction() override = default;
|
virtual ~PromiseAllSettledResolveElementFunction() override = default;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class PromiseAllSettledRejectElementFunction final : public PromiseResolvingElem
|
||||||
JS_OBJECT(PromiseResolvingFunction, PromiseResolvingElementFunction);
|
JS_OBJECT(PromiseResolvingFunction, PromiseResolvingElementFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PromiseAllSettledRejectElementFunction* create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
static NonnullGCPtr<PromiseAllSettledRejectElementFunction> create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
||||||
|
|
||||||
virtual ~PromiseAllSettledRejectElementFunction() override = default;
|
virtual ~PromiseAllSettledRejectElementFunction() override = default;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class PromiseAnyRejectElementFunction final : public PromiseResolvingElementFunc
|
||||||
JS_OBJECT(PromiseResolvingFunction, PromiseResolvingElementFunction);
|
JS_OBJECT(PromiseResolvingFunction, PromiseResolvingElementFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PromiseAnyRejectElementFunction* create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
static NonnullGCPtr<PromiseAnyRejectElementFunction> create(Realm&, size_t, PromiseValueList&, NonnullGCPtr<PromiseCapability>, RemainingElements&);
|
||||||
|
|
||||||
virtual ~PromiseAnyRejectElementFunction() override = default;
|
virtual ~PromiseAnyRejectElementFunction() override = default;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue