1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibJS: Add the Intl namespace object :^)

This is the start of implementing ECMA-402 in LibJS, better known as the
ECMAScript Internationalization API.

Much like Temporal this gets its own subdirectory (Runtime/Intl/) as
well as a new C++ namespace (JS::Intl) so we don't have to prefix all
the files and classes with "Intl".

https://tc39.es/ecma402/
This commit is contained in:
Linus Groh 2021-08-08 18:27:28 +01:00
parent 7d8c182359
commit a37dcf8ca7
5 changed files with 49 additions and 0 deletions

View file

@ -41,6 +41,7 @@
#include <LibJS/Runtime/GeneratorObjectPrototype.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Intl/Intl.h>
#include <LibJS/Runtime/IteratorPrototype.h>
#include <LibJS/Runtime/JSONObject.h>
#include <LibJS/Runtime/MapConstructor.h>
@ -203,6 +204,7 @@ void GlobalObject::initialize_global_object()
define_direct_property(vm.names.Math, heap().allocate<MathObject>(*this, *this), attr);
define_direct_property(vm.names.JSON, heap().allocate<JSONObject>(*this, *this), attr);
define_direct_property(vm.names.Reflect, heap().allocate<ReflectObject>(*this, *this), attr);
define_direct_property(vm.names.Intl, heap().allocate<Intl::Intl>(*this, *this), attr);
define_direct_property(vm.names.Temporal, heap().allocate<Temporal::Temporal>(*this, *this), attr);
// This must be initialized before allocating AggregateErrorConstructor, which uses ErrorConstructor as its prototype.