1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibJS: Fix build (GlobalObject::add_constructor not visible in LibWeb)

This commit is contained in:
Andreas Kling 2020-05-02 20:43:44 +02:00
parent 99be27b4a1
commit c00ff4ba62
2 changed files with 10 additions and 9 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <LibJS/Heap/Heap.h>
#include <LibJS/Runtime/Object.h>
namespace JS {
@ -67,4 +68,13 @@ private:
#undef __JS_ENUMERATE
};
template<typename ConstructorType>
inline 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);
}
}