mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-17 07:41:54 +00:00
LibJS: Define length and name in function in correct order
This commit is contained in:
parent
9394cbcd24
commit
1c7c53e5a0
Notes:
sideshowbarker
2024-07-18 02:21:16 +09:00
Author: https://github.com/davidot
Commit: 1c7c53e5a0
Pull-request: https://github.com/SerenityOS/serenity/pull/10483
Issue: https://github.com/SerenityOS/serenity/issues/8198
Reviewed-by: https://github.com/linusg ✅
1 changed files with 3 additions and 2 deletions
|
@ -76,6 +76,9 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
|||
{
|
||||
auto& vm = this->vm();
|
||||
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) {
|
||||
auto* prototype = vm.heap().allocate<Object>(global_object, *global_object.new_ordinary_function_prototype_object_shape());
|
||||
switch (m_kind) {
|
||||
|
@ -89,8 +92,6 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
|||
}
|
||||
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue