[][src]Trait darklua_core::process::Scope

pub trait Scope {
    fn push(&mut self);
fn pop(&mut self);
fn insert(&mut self, identifier: &mut String);
fn insert_local(
        &mut self,
        identifier: &mut String,
        value: Option<&mut Expression>
    );
fn insert_local_function(&mut self, function: &mut LocalFunctionStatement); }

Defines methods to interact with the concept of lexical scoping. The struct implementing this trait should be able to keep track of identifiers when used along the ScopeVisitor.

Required methods

fn push(&mut self)

This method is called when a new block is entered.

fn pop(&mut self)

When a block is left, this method should should free all identifiers inserted in the previous block.

fn insert(&mut self, identifier: &mut String)

Called when a entering a function block, with each parameters of the function.

fn insert_local(
    &mut self,
    identifier: &mut String,
    value: Option<&mut Expression>
)

Called when a new local variable is initialized.

fn insert_local_function(&mut self, function: &mut LocalFunctionStatement)

Called when a new local function is initialized.

Loading content...

Implementors

Loading content...