1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +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

@ -654,10 +654,11 @@ void ReplObject::initialize_global_object()
{
Base::initialize_global_object();
define_direct_property("global", this, JS::Attribute::Enumerable);
define_native_function("exit", exit_interpreter);
define_native_function("help", repl_help);
define_native_function("load", load_file, 1);
define_native_function("save", save_to_file, 1);
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
define_native_function("exit", exit_interpreter, 0, attr);
define_native_function("help", repl_help, 0, attr);
define_native_function("load", load_file, 1, attr);
define_native_function("save", save_to_file, 1, attr);
}
JS_DEFINE_NATIVE_FUNCTION(ReplObject::save_to_file)
@ -701,7 +702,8 @@ void ScriptObject::initialize_global_object()
{
Base::initialize_global_object();
define_direct_property("global", this, JS::Attribute::Enumerable);
define_native_function("load", load_file, 1);
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
define_native_function("load", load_file, 1, attr);
}
JS_DEFINE_NATIVE_FUNCTION(ScriptObject::load_file)