1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

LibJS: Add "name" property to functions

This commit is contained in:
Linus Groh 2020-05-02 19:18:55 +01:00 committed by Andreas Kling
parent d007e8d00f
commit 99be27b4a1
16 changed files with 118 additions and 16 deletions

View file

@ -61,6 +61,7 @@ template<typename ConstructorType>
void GlobalObject::add_constructor(const FlyString& property_name, ConstructorType*& constructor, Object& prototype)
{
constructor = heap().allocate<ConstructorType>();
constructor->put("name", js_string(heap(), property_name), Attribute::Configurable);
prototype.put("constructor", constructor);
put(property_name, constructor, Attribute::Writable | Attribute::Configurable);
}