LibJS: Add a global "Object" constructor

This patch adds an "Object" constructor to the global object. The only
function it implements so far is Object.getPrototypeOf().
This commit is contained in:
Andreas Kling 2020-03-28 17:23:54 +01:00
parent a3d92b1210
commit 14047ca432
Notes: sideshowbarker 2024-07-19 08:05:39 +09:00
9 changed files with 134 additions and 3 deletions

View file

@ -6,6 +6,7 @@
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/MathObject.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/ObjectConstructor.h>
#include <LibJS/Runtime/Value.h>
namespace JS {
@ -24,6 +25,7 @@ GlobalObject::GlobalObject()
return Value(arguments[0].to_number().is_nan());
});
put("Math", heap().allocate<MathObject>());
put("Object", heap().allocate<ObjectConstructor>());
}
GlobalObject::~GlobalObject()