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

LibJS: Remove UndefinedLiteral, add undefined to global object

There is no such thing as a "undefined literal" in JS - undefined is
just a property on the global object with a value of undefined.
This is pretty similar to NaN.

var undefined = "foo"; is a perfectly fine AssignmentExpression :^)
This commit is contained in:
Linus Groh 2020-04-02 22:08:14 +01:00 committed by Andreas Kling
parent 543c6e00db
commit 2636cac6e4
6 changed files with 1 additions and 30 deletions

View file

@ -21,6 +21,7 @@ GlobalObject::GlobalObject()
// FIXME: These are read-only in ES5
put("NaN", js_nan());
put("Infinity", js_infinity());
put("undefined", js_undefined());
put("console", heap().allocate<ConsoleObject>());
put("Date", heap().allocate<DateConstructor>());