Intl.cpp 908 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Runtime/GlobalObject.h>
  7. #include <LibJS/Runtime/Intl/DisplayNamesConstructor.h>
  8. #include <LibJS/Runtime/Intl/Intl.h>
  9. namespace JS::Intl {
  10. // 8 The Intl Object, https://tc39.es/ecma402/#intl-object
  11. Intl::Intl(GlobalObject& global_object)
  12. : Object(*global_object.object_prototype())
  13. {
  14. }
  15. void Intl::initialize(GlobalObject& global_object)
  16. {
  17. Object::initialize(global_object);
  18. auto& vm = this->vm();
  19. // 8.1.1 Intl[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl-toStringTag
  20. define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl"), Attribute::Configurable);
  21. u8 attr = Attribute::Writable | Attribute::Configurable;
  22. define_direct_property(vm.names.DisplayNames, global_object.intl_display_names_constructor(), attr);
  23. }
  24. }