1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 05:27:35 +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:
Andreas Kling 2020-04-18 13:18:06 +02:00
parent cbcf317e76
commit fca08bd000
40 changed files with 131 additions and 101 deletions

View file

@ -50,6 +50,7 @@ Vector<String> repl_statements;
class ReplObject : public JS::GlobalObject {
public:
ReplObject();
virtual void initialize() override;
virtual ~ReplObject() override;
static JS::Value load_file(JS::Interpreter&);
@ -270,6 +271,11 @@ bool write_to_file(const StringView& path)
ReplObject::ReplObject()
{
}
void ReplObject::initialize()
{
GlobalObject::initialize();
put_native_function("exit", exit_interpreter);
put_native_function("help", repl_help);
put_native_function("load", load_file, 1);