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

LibJS: Remove the default length & attributes from define_native_*

These are usually incorrect, and people sometimes forget to add the
correct values as a result of them being optional, so they should just
be specified explicitly.
This commit is contained in:
Idan Horowitz 2021-07-06 01:12:54 +03:00 committed by Linus Groh
parent a6b8291a9b
commit 53f70e5208
10 changed files with 48 additions and 43 deletions

View file

@ -21,16 +21,17 @@ void ConsoleObject::initialize(GlobalObject& global_object)
{
auto& vm = this->vm();
Object::initialize(global_object);
define_native_function(vm.names.log, log);
define_native_function(vm.names.debug, debug);
define_native_function(vm.names.info, info);
define_native_function(vm.names.warn, warn);
define_native_function(vm.names.error, error);
define_native_function(vm.names.trace, trace);
define_native_function(vm.names.count, count);
define_native_function(vm.names.countReset, count_reset);
define_native_function(vm.names.clear, clear);
define_native_function(vm.names.assert, assert_);
u8 attr = Attribute::Writable | Attribute::Enumerable | Attribute::Configurable;
define_native_function(vm.names.log, log, 0, attr);
define_native_function(vm.names.debug, debug, 0, attr);
define_native_function(vm.names.info, info, 0, attr);
define_native_function(vm.names.warn, warn, 0, attr);
define_native_function(vm.names.error, error, 0, attr);
define_native_function(vm.names.trace, trace, 0, attr);
define_native_function(vm.names.count, count, 0, attr);
define_native_function(vm.names.countReset, count_reset, 0, attr);
define_native_function(vm.names.clear, clear, 0, attr);
define_native_function(vm.names.assert, assert_, 0, attr);
}
ConsoleObject::~ConsoleObject()

View file

@ -131,9 +131,9 @@ public:
void define_direct_property(PropertyName const& property_name, Value value, PropertyAttributes attributes) { storage_set(property_name, { value, attributes }); };
void define_direct_accessor(PropertyName const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes);
void define_native_function(PropertyName const&, Function<Value(VM&, GlobalObject&)>, i32 length = 0, PropertyAttributes attributes = default_attributes);
void define_native_property(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<void(VM&, GlobalObject&, Value)> setter, PropertyAttributes attributes = default_attributes);
void define_native_accessor(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attributes = default_attributes);
void define_native_function(PropertyName const&, Function<Value(VM&, GlobalObject&)>, i32 length, PropertyAttributes attributes);
void define_native_property(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<void(VM&, GlobalObject&, Value)> setter, PropertyAttributes attributes);
void define_native_accessor(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attributes);
virtual bool is_array() const { return false; }
virtual bool is_function() const { return false; }