PluralRulesPrototype.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Jint.Collections;
  2. using Jint.Native.Object;
  3. using Jint.Native.Symbol;
  4. using Jint.Runtime;
  5. using Jint.Runtime.Descriptors;
  6. namespace Jint.Native.Intl;
  7. /// <summary>
  8. /// https://tc39.es/ecma402/#sec-properties-of-intl-pluralrules-prototype-object
  9. /// </summary>
  10. internal sealed class PluralRulesPrototype : Prototype
  11. {
  12. private readonly PluralRulesConstructor _constructor;
  13. public PluralRulesPrototype(
  14. Engine engine,
  15. Realm realm,
  16. PluralRulesConstructor constructor,
  17. ObjectPrototype objectPrototype) : base(engine, realm)
  18. {
  19. _prototype = objectPrototype;
  20. _constructor = constructor;
  21. }
  22. protected override void Initialize()
  23. {
  24. var properties = new PropertyDictionary(2, checkExistingKeys: false)
  25. {
  26. ["constructor"] = new PropertyDescriptor(_constructor, true, false, true),
  27. };
  28. SetProperties(properties);
  29. var symbols = new SymbolDictionary(1)
  30. {
  31. [GlobalSymbolRegistry.ToStringTag] = new("Intl.PluralRules", PropertyFlag.Configurable)
  32. };
  33. SetSymbols(symbols);
  34. }
  35. }