mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00:00
LibJS: Mark IteratorHelper::create as infallible
This is just allocating an IteratorHelper. There is no way for this to throw an exception.
This commit is contained in:
committed by
Andreas Kling
parent
e011f8d6b1
commit
6976ff389e
Notes:
github-actions[bot]
2025-12-03 11:10:01 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/6976ff389e6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7002
@@ -13,7 +13,7 @@ namespace JS {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(IteratorHelper);
|
||||
|
||||
ThrowCompletionOr<GC::Ref<IteratorHelper>> IteratorHelper::create(Realm& realm, ReadonlySpan<GC::Ref<IteratorRecord>> underlying_iterators, GC::Ref<Closure> closure, GC::Ptr<AbruptClosure> abrupt_closure)
|
||||
GC::Ref<IteratorHelper> IteratorHelper::create(Realm& realm, ReadonlySpan<GC::Ref<IteratorRecord>> underlying_iterators, GC::Ref<Closure> closure, GC::Ptr<AbruptClosure> abrupt_closure)
|
||||
{
|
||||
return realm.create<IteratorHelper>(realm, realm.intrinsics().iterator_helper_prototype(), underlying_iterators, closure, abrupt_closure);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
using Closure = GC::Function<ThrowCompletionOr<Value>(VM&, IteratorHelper&)>;
|
||||
using AbruptClosure = GC::Function<ThrowCompletionOr<Value>(VM&, IteratorHelper&, Completion const&)>;
|
||||
|
||||
static ThrowCompletionOr<GC::Ref<IteratorHelper>> create(Realm&, ReadonlySpan<GC::Ref<IteratorRecord>>, GC::Ref<Closure>, GC::Ptr<AbruptClosure> = {});
|
||||
static GC::Ref<IteratorHelper> create(Realm&, ReadonlySpan<GC::Ref<IteratorRecord>>, GC::Ref<Closure>, GC::Ptr<AbruptClosure> = {});
|
||||
|
||||
ReadonlySpan<GC::Ref<IteratorRecord>> underlying_iterators() const { return m_underlying_iterators; }
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::drop)
|
||||
|
||||
// 11. Let result be CreateIteratorFromClosure(closure, "Iterator Helper", %IteratorHelperPrototype%, « [[UnderlyingIterators]] »).
|
||||
// 12. Set result.[[UnderlyingIterators]] to « iterated ».
|
||||
auto result = TRY(IteratorHelper::create(realm, { { iterated } }, closure));
|
||||
auto result = IteratorHelper::create(realm, { { iterated } }, closure);
|
||||
|
||||
// 11. Return result.
|
||||
return result;
|
||||
@@ -264,7 +264,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::filter)
|
||||
|
||||
// 7. Let result be CreateIteratorFromClosure(closure, "Iterator Helper", %IteratorHelperPrototype%, « [[UnderlyingIterators]] »).
|
||||
// 8. Set result.[[UnderlyingIterators]] to « iterated ».
|
||||
auto result = TRY(IteratorHelper::create(realm, { { iterated } }, closure));
|
||||
auto result = IteratorHelper::create(realm, { { iterated } }, closure);
|
||||
|
||||
// 9. Return result.
|
||||
return result;
|
||||
@@ -462,7 +462,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::flat_map)
|
||||
|
||||
// 8. Let result be CreateIteratorFromClosure(closure, "Iterator Helper", %IteratorHelperPrototype%, « [[UnderlyingIterators]] »).
|
||||
// 9. Set result.[[UnderlyingIterators]] to « iterated ».
|
||||
auto result = TRY(IteratorHelper::create(realm, { { iterated } }, closure, move(abrupt_closure)));
|
||||
auto result = IteratorHelper::create(realm, { { iterated } }, closure, move(abrupt_closure));
|
||||
|
||||
// 9. Return result.
|
||||
return result;
|
||||
@@ -569,7 +569,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::map)
|
||||
|
||||
// 7. Let result be CreateIteratorFromClosure(closure, "Iterator Helper", %IteratorHelperPrototype%, « [[UnderlyingIterators]] »).
|
||||
// 8. Set result.[[UnderlyingIterators]] to « iterated ».
|
||||
auto result = TRY(IteratorHelper::create(realm, { { iterated } }, closure));
|
||||
auto result = IteratorHelper::create(realm, { { iterated } }, closure);
|
||||
|
||||
// 9. Return result.
|
||||
return result;
|
||||
@@ -773,7 +773,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::take)
|
||||
|
||||
// 11. Let result be CreateIteratorFromClosure(closure, "Iterator Helper", %IteratorHelperPrototype%, « [[UnderlyingIterators]] »).
|
||||
// 12. Set result.[[UnderlyingIterators]] to « iterated ».
|
||||
auto result = TRY(IteratorHelper::create(realm, { { iterated } }, closure));
|
||||
auto result = IteratorHelper::create(realm, { { iterated } }, closure);
|
||||
|
||||
// 13. Return result.
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user