EnvironmentRecord.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. namespace Jint.Runtime.Environments
  2. {
  3. /// <summary>
  4. /// Base implementation of an Environment Record
  5. /// http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.1
  6. /// </summary>
  7. public abstract class EnvironmentRecord
  8. {
  9. /// <summary>
  10. /// Determines if an environment record has a binding for an identifier.
  11. /// </summary>
  12. /// <param name="name">The identifier of the binding</param>
  13. /// <returns><c>true</c> if it does and <c>false</c> if it does not.</returns>
  14. public abstract bool HasBinding(string name);
  15. /// <summary>
  16. /// Creates a new mutable binding in an environment record.
  17. /// </summary>
  18. /// <param name="name">The identifier of the binding.</param>
  19. /// <param name="canBeDeleted"><c>true</c> if the binding may be subsequently deleted.</param>
  20. public abstract void CreateMutableBinding(string name, bool canBeDeleted = false);
  21. /// <summary>
  22. /// Sets the value of an already existing mutable binding in an environment record.
  23. /// </summary>
  24. /// <param name="name">The identifier of the binding</param>
  25. /// <param name="value">The value of the binding.</param>
  26. /// <param name="strict">The identify strict mode references.</param>
  27. public abstract void SetMutableBinding(string name, object value, bool strict);
  28. /// <summary>
  29. /// Returns the value of an already existing binding from an environment record.
  30. /// </summary>
  31. /// <param name="name">The identifier of the binding</param>
  32. /// <param name="strict">The identify strict mode references.</param>
  33. /// <return>The value of an already existing binding from an environment record.</return>
  34. public abstract object GetBindingValue(string name, bool strict);
  35. /// <summary>
  36. /// Delete a binding from an environment record. The String value N is the text of the bound name If a binding for N exists, remove the binding and return true. If the binding exists but cannot be removed return false. If the binding does not exist return true.
  37. /// </summary>
  38. /// <param name="name">The identifier of the binding</param>
  39. /// <returns><true>true</true> if the deletion is successfull.</returns>
  40. public abstract bool DeleteBinding(string name);
  41. /// <summary>
  42. /// Returns the value to use as the <c>this</c> value on calls to function objects that are obtained as binding values from this environment record.
  43. /// </summary>
  44. /// <returns>The value to use as <c>this</c>.</returns>
  45. public abstract object ImplicitThisValue();
  46. }
  47. }