From be0dcd465f3308bfb4221f11dd56900c78eacf10 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 11 Mar 2023 17:27:17 +0000 Subject: [PATCH] LibJS: Fix return type of Object::create_method_property() This doesn't return a completion in the spec as it doesn't need to propagate any errors. It's also unused right now, which is probably why no one noticed. --- Userland/Libraries/LibJS/Runtime/Object.cpp | 5 ++--- Userland/Libraries/LibJS/Runtime/Object.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 88015c463e..5d036c8dfa 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling - * Copyright (c) 2020-2022, Linus Groh + * Copyright (c) 2020-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -139,7 +139,7 @@ ThrowCompletionOr Object::create_data_property(PropertyKey const& property } // 7.3.6 CreateMethodProperty ( O, P, V ), https://tc39.es/ecma262/#sec-createmethodproperty -ThrowCompletionOr Object::create_method_property(PropertyKey const& property_key, Value value) +void Object::create_method_property(PropertyKey const& property_key, Value value) { VERIFY(property_key.is_valid()); VERIFY(!value.is_empty()); @@ -158,7 +158,6 @@ ThrowCompletionOr Object::create_method_property(PropertyKey const& proper MUST(internal_define_own_property(property_key, new_descriptor)); // 4. Return unused. - return {}; } // 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 824965ec79..4ae4a7db30 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling - * Copyright (c) 2020-2022, Linus Groh + * Copyright (c) 2020-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -90,7 +90,7 @@ public: ThrowCompletionOr get(PropertyKey const&) const; ThrowCompletionOr set(PropertyKey const&, Value, ShouldThrowExceptions); ThrowCompletionOr create_data_property(PropertyKey const&, Value); - ThrowCompletionOr create_method_property(PropertyKey const&, Value); + void create_method_property(PropertyKey const&, Value); ThrowCompletionOr create_data_property_or_throw(PropertyKey const&, Value); void create_non_enumerable_data_property_or_throw(PropertyKey const&, Value); ThrowCompletionOr define_property_or_throw(PropertyKey const&, PropertyDescriptor const&);