1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:18:12 +00:00

LibJS: Start implementing Date :^)

This adds:

- A global Date object (with `length` property and `now` function)
- The Date constructor (no arguments yet)
- The Date prototype (with `get*` functions)
This commit is contained in:
Linus Groh 2020-03-30 00:21:56 +01:00 committed by Andreas Kling
parent 5c779c124b
commit d4e3688f4f
25 changed files with 567 additions and 5 deletions

View file

@ -28,6 +28,7 @@
#include <LibJS/AST.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/ArrayPrototype.h>
#include <LibJS/Runtime/DatePrototype.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/ErrorPrototype.h>
#include <LibJS/Runtime/GlobalObject.h>
@ -46,6 +47,7 @@ Interpreter::Interpreter()
m_string_prototype = heap().allocate<StringPrototype>();
m_array_prototype = heap().allocate<ArrayPrototype>();
m_error_prototype = heap().allocate<ErrorPrototype>();
m_date_prototype = heap().allocate<DatePrototype>();
m_global_object = heap().allocate<GlobalObject>();
}
@ -165,6 +167,7 @@ void Interpreter::gather_roots(Badge<Heap>, HashTable<Cell*>& roots)
roots.set(m_object_prototype);
roots.set(m_array_prototype);
roots.set(m_error_prototype);
roots.set(m_date_prototype);
roots.set(m_exception);