mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 07:07:36 +00:00
LibJS: Define length and name in function in correct order
This commit is contained in:
parent
9394cbcd24
commit
1c7c53e5a0
1 changed files with 3 additions and 2 deletions
|
@ -76,6 +76,9 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
||||||
{
|
{
|
||||||
auto& vm = this->vm();
|
auto& vm = this->vm();
|
||||||
Base::initialize(global_object);
|
Base::initialize(global_object);
|
||||||
|
MUST(define_property_or_throw(vm.names.length, { .value = Value(m_function_length), .writable = false, .enumerable = false, .configurable = true }));
|
||||||
|
MUST(define_property_or_throw(vm.names.name, { .value = js_string(vm, m_name.is_null() ? "" : m_name), .writable = false, .enumerable = false, .configurable = true }));
|
||||||
|
|
||||||
if (!m_is_arrow_function) {
|
if (!m_is_arrow_function) {
|
||||||
auto* prototype = vm.heap().allocate<Object>(global_object, *global_object.new_ordinary_function_prototype_object_shape());
|
auto* prototype = vm.heap().allocate<Object>(global_object, *global_object.new_ordinary_function_prototype_object_shape());
|
||||||
switch (m_kind) {
|
switch (m_kind) {
|
||||||
|
@ -89,8 +92,6 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
||||||
}
|
}
|
||||||
define_direct_property(vm.names.prototype, prototype, Attribute::Writable);
|
define_direct_property(vm.names.prototype, prototype, Attribute::Writable);
|
||||||
}
|
}
|
||||||
MUST(define_property_or_throw(vm.names.length, { .value = Value(m_function_length), .writable = false, .enumerable = false, .configurable = true }));
|
|
||||||
MUST(define_property_or_throw(vm.names.name, { .value = js_string(vm, m_name.is_null() ? "" : m_name), .writable = false, .enumerable = false, .configurable = true }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ECMAScriptFunctionObject::~ECMAScriptFunctionObject()
|
ECMAScriptFunctionObject::~ECMAScriptFunctionObject()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue