AsyncFunctionPrototype.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Jint.Native.Function;
  2. using Jint.Native.Symbol;
  3. using Jint.Runtime;
  4. using Jint.Runtime.Descriptors;
  5. namespace Jint.Native.AsyncFunction;
  6. /// <summary>
  7. /// https://tc39.es/ecma262/#sec-async-function-prototype-properties
  8. /// </summary>
  9. internal sealed class AsyncFunctionPrototype : Prototype
  10. {
  11. private readonly AsyncFunctionConstructor _constructor;
  12. public AsyncFunctionPrototype(
  13. Engine engine,
  14. Realm realm,
  15. AsyncFunctionConstructor constructor,
  16. FunctionPrototype objectPrototype) : base(engine, realm)
  17. {
  18. _constructor = constructor;
  19. _prototype = objectPrototype;
  20. }
  21. protected override void Initialize()
  22. {
  23. var properties = new PropertyDictionary(1, checkExistingKeys: false)
  24. {
  25. [KnownKeys.Constructor] = new(_constructor, PropertyFlag.NonEnumerable),
  26. };
  27. SetProperties(properties);
  28. var symbols = new SymbolDictionary(1)
  29. {
  30. [GlobalSymbolRegistry.ToStringTag] = new("AsyncFunction", PropertyFlag.Configurable)
  31. };
  32. SetSymbols(symbols);
  33. }
  34. }