mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibJS: Add comment clarifying the order of function properties
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 02:21:08 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/7beccaf41b4 Pull-request: https://github.com/SerenityOS/serenity/pull/10485
@@ -76,6 +76,12 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Base::initialize(global_object);
|
||||
// Note: The ordering of these properties must be: length, name, prototype which is the order
|
||||
// they are defined in the spec: https://tc39.es/ecma262/#sec-function-instances .
|
||||
// This is observable through something like: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys
|
||||
// which must give the properties in chronological order which in this case is the order they
|
||||
// are defined in the spec.
|
||||
|
||||
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 }));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user