AsyncFunctionPrototype.cs 1.1 KB

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