1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-03 00:42:14 +00:00

LibJS: Add [[InitialName]] and use it in Function.prototype.toString()

This commit is contained in:
Linus Groh 2022-02-20 17:13:16 +00:00
parent 0be67ef12c
commit e657e88ed6
4 changed files with 18 additions and 4 deletions

View file

@ -61,7 +61,7 @@ void FunctionObject::set_function_name(Variant<PropertyKey, PrivateName> const&
// 4. If F has an [[InitialName]] internal slot, then
if (is<NativeFunction>(this)) {
// a. Set F.[[InitialName]] to name.
// TODO: Remove FunctionObject::name(), implement NativeFunction::initial_name(), and then do this.
static_cast<NativeFunction&>(*this).set_initial_name({}, name);
}
// 5. If prefix is present, then
@ -72,7 +72,7 @@ void FunctionObject::set_function_name(Variant<PropertyKey, PrivateName> const&
// b. If F has an [[InitialName]] internal slot, then
if (is<NativeFunction>(this)) {
// i. Optionally, set F.[[InitialName]] to name.
// TODO: See above.
static_cast<NativeFunction&>(*this).set_initial_name({}, name);
}
}