mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
LibJS: Define the "constructor" property on ScriptFunction's prototype
and set it to the current function
This commit is contained in:
committed by
Andreas Kling
parent
f833362536
commit
949bffdc93
@@ -66,8 +66,11 @@ ScriptFunction::ScriptFunction(GlobalObject& global_object, const FlyString& nam
|
||||
void ScriptFunction::initialize(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
Function::initialize(interpreter, global_object);
|
||||
if (!m_is_arrow_function)
|
||||
define_property("prototype", Object::create_empty(interpreter, global_object), 0);
|
||||
if (!is_arrow_function) {
|
||||
Object* prototype = Object::create_empty(interpreter(), interpreter().global_object());
|
||||
prototype->define_property("constructor", this, Attribute::Writable | Attribute::Configurable);
|
||||
define_property("prototype", prototype, 0);
|
||||
}
|
||||
define_native_property("length", length_getter, nullptr, Attribute::Configurable);
|
||||
define_native_property("name", name_getter, nullptr, Attribute::Configurable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user