Binding.cs 888 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Diagnostics;
  2. using Jint.Native;
  3. namespace Jint.Runtime.Environments
  4. {
  5. [DebuggerDisplay("Mutable: {Mutable}, Strict: {Strict}, CanBeDeleted: {CanBeDeleted}, Value: {Value}")]
  6. internal readonly struct Binding
  7. {
  8. public Binding(
  9. JsValue value,
  10. bool canBeDeleted,
  11. bool mutable,
  12. bool strict)
  13. {
  14. Value = value;
  15. CanBeDeleted = canBeDeleted;
  16. Mutable = mutable;
  17. Strict = strict;
  18. }
  19. public readonly JsValue Value;
  20. public readonly bool CanBeDeleted;
  21. public readonly bool Mutable;
  22. public readonly bool Strict;
  23. public Binding ChangeValue(JsValue argument)
  24. {
  25. return new Binding(argument, CanBeDeleted, Mutable, Strict);
  26. }
  27. public bool IsInitialized() => Value is not null;
  28. }
  29. }