summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-10-29 01:07:30 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2021-10-29 21:29:24 +0300
commit658056233eb47a4493a11d56dd84d591e4717edf (patch)
treedce3f0e71f5a710065eecfd8892349d454d222a7
parent7b5ccbc5ed1a31f1dd8a162f9ab77ba83e08670e (diff)
downloadserenity-658056233eb47a4493a11d56dd84d591e4717edf.zip
LibJS: Convert GeneratorObjectPrototype functions to ThrowCompletionOr
-rw-r--r--Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp18
-rw-r--r--Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.h6
2 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp
index a322f694a0..bbc0a922a4 100644
--- a/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp
@@ -20,9 +20,9 @@ void GeneratorObjectPrototype::initialize(GlobalObject& global_object)
auto& vm = this->vm();
Object::initialize(global_object);
u8 attr = Attribute::Writable | Attribute::Configurable;
- define_old_native_function(vm.names.next, next, 1, attr);
- define_old_native_function(vm.names.return_, return_, 1, attr);
- define_old_native_function(vm.names.throw_, throw_, 1, attr);
+ define_native_function(vm.names.next, next, 1, attr);
+ define_native_function(vm.names.return_, return_, 1, attr);
+ define_native_function(vm.names.throw_, throw_, 1, attr);
// 27.5.1.5 Generator.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-generator.prototype-@@tostringtag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Generator"), Attribute::Configurable);
@@ -33,24 +33,24 @@ GeneratorObjectPrototype::~GeneratorObjectPrototype()
}
// 27.5.1.2 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.next
-JS_DEFINE_OLD_NATIVE_FUNCTION(GeneratorObjectPrototype::next)
+JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::next)
{
- auto* generator_object = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* generator_object = TRY(typed_this_object(global_object));
return generator_object->next_impl(vm, global_object, {});
}
// 27.5.1.3 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.return
-JS_DEFINE_OLD_NATIVE_FUNCTION(GeneratorObjectPrototype::return_)
+JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::return_)
{
- auto* generator_object = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* generator_object = TRY(typed_this_object(global_object));
generator_object->set_done();
return generator_object->next_impl(vm, global_object, {});
}
// 27.5.1.4 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.throw
-JS_DEFINE_OLD_NATIVE_FUNCTION(GeneratorObjectPrototype::throw_)
+JS_DEFINE_NATIVE_FUNCTION(GeneratorObjectPrototype::throw_)
{
- auto* generator_object = TRY_OR_DISCARD(typed_this_object(global_object));
+ auto* generator_object = TRY(typed_this_object(global_object));
return generator_object->next_impl(vm, global_object, vm.argument(0));
}
diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.h b/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.h
index 3851874763..776c5da123 100644
--- a/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.h
+++ b/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.h
@@ -21,9 +21,9 @@ public:
virtual ~GeneratorObjectPrototype() override;
private:
- JS_DECLARE_OLD_NATIVE_FUNCTION(next);
- JS_DECLARE_OLD_NATIVE_FUNCTION(return_);
- JS_DECLARE_OLD_NATIVE_FUNCTION(throw_);
+ JS_DECLARE_NATIVE_FUNCTION(next);
+ JS_DECLARE_NATIVE_FUNCTION(return_);
+ JS_DECLARE_NATIVE_FUNCTION(throw_);
};
}