1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:27:35 +00:00

LibJS: Convert SetIteratorPrototype functions to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-29 00:19:34 +03:00
parent d46d8c9016
commit 6b954b9e76
2 changed files with 4 additions and 4 deletions

View file

@ -23,7 +23,7 @@ void SetIteratorPrototype::initialize(GlobalObject& global_object)
auto& vm = this->vm(); auto& vm = this->vm();
Object::initialize(global_object); Object::initialize(global_object);
define_old_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable);
// 24.2.5.2.2 %SetIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%setiteratorprototype%-@@tostringtag // 24.2.5.2.2 %SetIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%setiteratorprototype%-@@tostringtag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Set Iterator"), Attribute::Configurable); define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Set Iterator"), Attribute::Configurable);
@ -34,9 +34,9 @@ SetIteratorPrototype::~SetIteratorPrototype()
} }
// 24.2.5.2.1 %SetIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%setiteratorprototype%.next // 24.2.5.2.1 %SetIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%setiteratorprototype%.next
JS_DEFINE_OLD_NATIVE_FUNCTION(SetIteratorPrototype::next) JS_DEFINE_NATIVE_FUNCTION(SetIteratorPrototype::next)
{ {
auto* set_iterator = TRY_OR_DISCARD(typed_this_value(global_object)); auto* set_iterator = TRY(typed_this_value(global_object));
if (set_iterator->done()) if (set_iterator->done())
return create_iterator_result_object(global_object, js_undefined(), true); return create_iterator_result_object(global_object, js_undefined(), true);

View file

@ -20,7 +20,7 @@ public:
virtual ~SetIteratorPrototype() override; virtual ~SetIteratorPrototype() override;
private: private:
JS_DECLARE_OLD_NATIVE_FUNCTION(next); JS_DECLARE_NATIVE_FUNCTION(next);
}; };
} }