mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 07:35:08 +00:00
LibJS: Move builtin prototypes to the global object
This moves us towards being able to run JavaScript in different global objects without allocating a separate GC heap.
This commit is contained in:
parent
cbcf317e76
commit
fca08bd000
40 changed files with 131 additions and 101 deletions
|
@ -27,13 +27,14 @@
|
|||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/ErrorConstructor.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
ErrorConstructor::ErrorConstructor()
|
||||
: NativeFunction("Error", *interpreter().function_prototype())
|
||||
: NativeFunction("Error", *interpreter().global_object().function_prototype())
|
||||
{
|
||||
put("prototype", interpreter().error_prototype());
|
||||
put("prototype", interpreter().global_object().error_prototype());
|
||||
put("length", Value(1));
|
||||
}
|
||||
|
||||
|
@ -56,9 +57,9 @@ Value ErrorConstructor::construct(Interpreter& interpreter)
|
|||
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||
ConstructorName::ConstructorName() \
|
||||
: NativeFunction(*interpreter().function_prototype()) \
|
||||
: NativeFunction(*interpreter().global_object().function_prototype()) \
|
||||
{ \
|
||||
put("prototype", interpreter().snake_name##_prototype()); \
|
||||
put("prototype", interpreter().global_object().snake_name##_prototype()); \
|
||||
put("length", Value(1)); \
|
||||
} \
|
||||
ConstructorName::~ConstructorName() {} \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue