using Jint.Native; namespace Jint.Runtime.Environments { /// /// Base implementation of an Environment Record /// http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.1 /// public abstract class EnvironmentRecord : JsValue { protected readonly Engine _engine; protected EnvironmentRecord(Engine engine) : base(Types.Object) { _engine = engine; } /// /// Determines if an environment record has a binding for an identifier. /// /// The identifier of the binding /// true if it does and false if it does not. public abstract bool HasBinding(in Key name); internal abstract bool TryGetBinding( in Key name, bool strict, out Binding binding, out JsValue value); /// /// Creates a new mutable binding in an environment record. /// /// The identifier of the binding. /// The value of the binding. /// true if the binding may be subsequently deleted. public abstract void CreateMutableBinding(in Key name, JsValue value, bool canBeDeleted = false); /// /// Sets the value of an already existing mutable binding in an environment record. /// /// The identifier of the binding /// The value of the binding. /// The identify strict mode references. public abstract void SetMutableBinding(in Key name, JsValue value, bool strict); /// /// Returns the value of an already existing binding from an environment record. /// /// The identifier of the binding /// The identify strict mode references. /// The value of an already existing binding from an environment record. public abstract JsValue GetBindingValue(in Key name, bool strict); /// /// 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. /// /// The identifier of the binding /// true if the deletion is successfull. public abstract bool DeleteBinding(in Key name); /// /// Returns the value to use as the this value on calls to function objects that are obtained as binding values from this environment record. /// /// The value to use as this. public abstract JsValue ImplicitThisValue(); /// /// Returns an array of all the defined binding names /// /// The array of all defined bindings public abstract string[] GetAllBindingNames(); public override object ToObject() { ExceptionHelper.ThrowNotSupportedException(); return null; } public override bool Equals(JsValue other) { ExceptionHelper.ThrowNotSupportedException(); return false; } /// /// Informs whether arguments instance was accessed and maybe thus stored, /// which makes it unsuitable for pooling and reuse. /// internal abstract void FunctionWasCalled(); } }