Realm.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Esprima.Ast;
  2. using Jint.Native;
  3. using Jint.Native.Object;
  4. using Jint.Runtime.Environments;
  5. namespace Jint.Runtime
  6. {
  7. public sealed class Realm
  8. {
  9. internal readonly Dictionary<Node, JsArray> _templateMap = new();
  10. // helps when debugging which nested realm we are in...
  11. #if DEBUG
  12. private static int globalId = 1;
  13. public Realm()
  14. {
  15. Id = globalId++;
  16. }
  17. internal int Id;
  18. #endif
  19. /// <summary>
  20. /// The intrinsic values used by code associated with this realm.
  21. /// </summary>
  22. public Intrinsics Intrinsics { get; internal set; } = null!;
  23. /// <summary>
  24. /// The global object for this realm.
  25. /// </summary>
  26. public ObjectInstance GlobalObject { get; internal set; } = null!;
  27. /// <summary>
  28. /// The global environment for this realm.
  29. /// </summary>
  30. internal GlobalEnvironment GlobalEnv { get; set; } = null!;
  31. /// <summary>
  32. /// Field reserved for use by hosts that need to associate additional information with a Realm Record.
  33. /// </summary>
  34. public object? HostDefined { get; set; }
  35. }
  36. }