diff --git a/Userland/Libraries/LibJS/Forward.h b/Userland/Libraries/LibJS/Forward.h index 3e49f8dcf8..f2a374aed4 100644 --- a/Userland/Libraries/LibJS/Forward.h +++ b/Userland/Libraries/LibJS/Forward.h @@ -6,12 +6,6 @@ #pragma once -#define JS_DECLARE_OLD_NATIVE_FUNCTION(name) \ - static JS::Value name(JS::VM&, JS::GlobalObject&) - -#define JS_DEFINE_OLD_NATIVE_FUNCTION(name) \ - JS::Value name([[maybe_unused]] JS::VM& vm, [[maybe_unused]] JS::GlobalObject& global_object) - #define JS_DECLARE_NATIVE_FUNCTION(name) \ static JS::ThrowCompletionOr name(JS::VM&, JS::GlobalObject&) diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 8035696b18..45af10a7e6 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -1045,29 +1045,6 @@ void Object::set_prototype(Object* new_prototype) m_shape = shape.create_prototype_transition(new_prototype); } -void Object::define_old_native_accessor(PropertyKey const& property_name, Function getter, Function setter, PropertyAttributes attribute) -{ - Function(VM&, GlobalObject&)> completion_getter = {}; - if (getter) { - completion_getter = [getter = move(getter)](auto& vm, auto& global_object) -> ThrowCompletionOr { - auto result = getter(vm, global_object); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); - return result; - }; - } - Function(VM&, GlobalObject&)> completion_setter = {}; - if (setter) { - completion_setter = [setter = move(setter)](auto& vm, auto& global_object) -> ThrowCompletionOr { - auto result = setter(vm, global_object); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); - return result; - }; - } - define_native_accessor(property_name, move(completion_getter), move(completion_setter), attribute); -} - void Object::define_native_accessor(PropertyKey const& property_name, Function(VM&, GlobalObject&)> getter, Function(VM&, GlobalObject&)> setter, PropertyAttributes attribute) { auto& vm = this->vm(); @@ -1134,17 +1111,6 @@ Value Object::get_without_side_effects(const PropertyKey& property_name) const return {}; } -void Object::define_old_native_function(PropertyKey const& property_name, Function native_function, i32 length, PropertyAttributes attribute) -{ - auto completion_native_function = [native_function = move(native_function), property_name](auto& vm, auto& global_object) -> ThrowCompletionOr { - auto result = native_function(vm, global_object); - if (auto* exception = vm.exception()) - return throw_completion(exception->value()); - return result; - }; - define_native_function(property_name, move(completion_native_function), length, attribute); -} - void Object::define_native_function(PropertyKey const& property_name, Function(VM&, GlobalObject&)> native_function, i32 length, PropertyAttributes attribute) { auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index 673fa5fd25..8b8a08d76b 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -148,10 +148,6 @@ public: void define_direct_property(PropertyKey const& property_name, Value value, PropertyAttributes attributes) { storage_set(property_name, { value, attributes }); }; void define_direct_accessor(PropertyKey const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes); - // Legacy methods - Remove once JS_DECLARE_OLD_NATIVE_FUNCTION is removed - void define_old_native_function(PropertyKey const&, Function, i32 length, PropertyAttributes attributes); - void define_old_native_accessor(PropertyKey const&, Function getter, Function setter, PropertyAttributes attributes); - void define_native_function(PropertyKey const&, Function(VM&, GlobalObject&)>, i32 length, PropertyAttributes attributes); void define_native_accessor(PropertyKey const&, Function(VM&, GlobalObject&)> getter, Function(VM&, GlobalObject&)> setter, PropertyAttributes attributes);