diff --git a/Libraries/LibJS/Runtime/GlobalObject.cpp b/Libraries/LibJS/Runtime/GlobalObject.cpp index baaf16f62e..4b9497efd1 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -57,15 +57,6 @@ namespace JS { -template -void GlobalObject::add_constructor(const FlyString& property_name, ConstructorType*& constructor, Object& prototype) -{ - constructor = heap().allocate(); - constructor->put("name", js_string(heap(), property_name), Attribute::Configurable); - prototype.put("constructor", constructor); - put(property_name, constructor, Attribute::Writable | Attribute::Configurable); -} - GlobalObject::GlobalObject() : Object(nullptr) { diff --git a/Libraries/LibJS/Runtime/GlobalObject.h b/Libraries/LibJS/Runtime/GlobalObject.h index 811cc28007..9d6c52c8b7 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Libraries/LibJS/Runtime/GlobalObject.h @@ -26,6 +26,7 @@ #pragma once +#include #include namespace JS { @@ -67,4 +68,13 @@ private: #undef __JS_ENUMERATE }; +template +inline void GlobalObject::add_constructor(const FlyString& property_name, ConstructorType*& constructor, Object& prototype) +{ + constructor = heap().allocate(); + constructor->put("name", js_string(heap(), property_name), Attribute::Configurable); + prototype.put("constructor", constructor); + put(property_name, constructor, Attribute::Writable | Attribute::Configurable); +} + }