[][src]Trait boa::environment::environment_record_trait::EnvironmentRecordTrait

pub trait EnvironmentRecordTrait: Debug + Trace + Finalize {
    pub fn has_binding(&self, name: &str) -> bool;
pub fn create_mutable_binding(
        &mut self,
        name: String,
        deletion: bool,
        allow_name_reuse: bool
    ) -> Result<(), ErrorKind>;
pub fn create_immutable_binding(
        &mut self,
        name: String,
        strict: bool
    ) -> Result<(), ErrorKind>;
pub fn initialize_binding(
        &mut self,
        name: &str,
        value: Value
    ) -> Result<(), ErrorKind>;
pub fn set_mutable_binding(
        &mut self,
        name: &str,
        value: Value,
        strict: bool
    ) -> Result<(), ErrorKind>;
pub fn get_binding_value(
        &self,
        name: &str,
        strict: bool
    ) -> Result<Value, ErrorKind>;
pub fn delete_binding(&mut self, name: &str) -> bool;
pub fn has_this_binding(&self) -> bool;
pub fn get_this_binding(&self) -> Result<Value, ErrorKind>;
pub fn has_super_binding(&self) -> bool;
pub fn with_base_object(&self) -> Value;
pub fn get_outer_environment(&self) -> Option<Environment>;
pub fn set_outer_environment(&mut self, env: Environment);
pub fn get_environment_type(&self) -> EnvironmentType;
pub fn get_global_object(&self) -> Option<Value>; }

https://tc39.es/ecma262/#sec-environment-records

In the ECMAScript specification Environment Records are hierachical and have a base class with abstract methods. In this implementation we have a trait which represents the behaviour of all EnvironmentRecord types.

Required methods

pub fn has_binding(&self, name: &str) -> bool[src]

Determine if an Environment Record has a binding for the String value N. Return true if it does and false if it does not.

pub fn create_mutable_binding(
    &mut self,
    name: String,
    deletion: bool,
    allow_name_reuse: bool
) -> Result<(), ErrorKind>
[src]

Create a new but uninitialized mutable binding in an Environment Record. The String value N is the text of the bound name. If the Boolean argument deletion is true the binding may be subsequently deleted.

  • allow_name_reuse - specifies whether or not reusing binding names is allowed.

Most variable names cannot be reused, but functions in JavaScript are allowed to have multiple paraments with the same name.

pub fn create_immutable_binding(
    &mut self,
    name: String,
    strict: bool
) -> Result<(), ErrorKind>
[src]

Create a new but uninitialized immutable binding in an Environment Record. The String value N is the text of the bound name. If strict is true then attempts to set it after it has been initialized will always throw an exception, regardless of the strict mode setting of operations that reference that binding.

pub fn initialize_binding(
    &mut self,
    name: &str,
    value: Value
) -> Result<(), ErrorKind>
[src]

Set the value of an already existing but uninitialized binding in an Environment Record. The String value N is the text of the bound name. V is the value for the binding and is a value of any ECMAScript language type.

pub fn set_mutable_binding(
    &mut self,
    name: &str,
    value: Value,
    strict: bool
) -> Result<(), ErrorKind>
[src]

Set the value of an already existing mutable binding in an Environment Record. The String value name is the text of the bound name. value is the value for the binding and may be a value of any ECMAScript language type. S is a Boolean flag. If strict is true and the binding cannot be set throw a TypeError exception.

pub fn get_binding_value(
    &self,
    name: &str,
    strict: bool
) -> Result<Value, ErrorKind>
[src]

Returns the value of an already existing binding from an Environment Record. The String value N is the text of the bound name. S is used to identify references originating in strict mode code or that otherwise require strict mode reference semantics.

pub fn delete_binding(&mut self, name: &str) -> bool[src]

Delete a binding from an Environment Record. The String value name is the text of the bound name. If a binding for name 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.

pub fn has_this_binding(&self) -> bool[src]

Determine if an Environment Record establishes a this binding. Return true if it does and false if it does not.

pub fn get_this_binding(&self) -> Result<Value, ErrorKind>[src]

Return the this binding from the environment

pub fn has_super_binding(&self) -> bool[src]

Determine if an Environment Record establishes a super method binding. Return true if it does and false if it does not.

pub fn with_base_object(&self) -> Value[src]

If this Environment Record is associated with a with statement, return the with object. Otherwise, return undefined.

pub fn get_outer_environment(&self) -> Option<Environment>[src]

Get the next environment up

pub fn set_outer_environment(&mut self, env: Environment)[src]

Set the next environment up

pub fn get_environment_type(&self) -> EnvironmentType[src]

Get the type of environment this is

pub fn get_global_object(&self) -> Option<Value>[src]

Fetch global variable

Loading content...

Implementors

impl EnvironmentRecordTrait for DeclarativeEnvironmentRecord[src]

impl EnvironmentRecordTrait for FunctionEnvironmentRecord[src]

impl EnvironmentRecordTrait for GlobalEnvironmentRecord[src]

impl EnvironmentRecordTrait for ObjectEnvironmentRecord[src]

Loading content...