From bb2499cd7a01225de511507e25cc0260fd64533a Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 3 Oct 2021 00:54:25 +0100 Subject: [PATCH] LibJS: Convert create_method_property() to ThrowCompletionOr --- Userland/Libraries/LibJS/Runtime/Object.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/Object.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 3b95ee4104..c2e67a2904 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -137,7 +137,7 @@ ThrowCompletionOr Object::create_data_property(PropertyName const& propert } // 7.3.6 CreateMethodProperty ( O, P, V ), https://tc39.es/ecma262/#sec-createmethodproperty -bool Object::create_method_property(PropertyName const& property_name, Value value) +ThrowCompletionOr Object::create_method_property(PropertyName const& property_name, Value value) { VERIFY(!value.is_empty()); @@ -155,7 +155,7 @@ bool Object::create_method_property(PropertyName const& property_name, Value val }; // 4. Return ? O.[[DefineOwnProperty]](P, newDesc). - return TRY_OR_DISCARD(internal_define_own_property(property_name, new_descriptor)); + return internal_define_own_property(property_name, new_descriptor); } // 7.3.7 CreateDataPropertyOrThrow ( O, P, V ), https://tc39.es/ecma262/#sec-createdatapropertyorthrow diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index 68a4df79a5..eecdcf0b35 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -78,7 +78,7 @@ public: ThrowCompletionOr get(PropertyName const&) const; ThrowCompletionOr set(PropertyName const&, Value, ShouldThrowExceptions); ThrowCompletionOr create_data_property(PropertyName const&, Value); - bool create_method_property(PropertyName const&, Value); + ThrowCompletionOr create_method_property(PropertyName const&, Value); bool create_data_property_or_throw(PropertyName const&, Value); bool create_non_enumerable_data_property_or_throw(PropertyName const&, Value); bool define_property_or_throw(PropertyName const&, PropertyDescriptor const&);