Trait darklua_core::process::Scope [−][src]
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);
}
Expand description
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
When a block is left, this method should should free all identifiers inserted in the previous block.
Called when entering a function block (with each parameters of the function), with the identifiers from a generic for statement or the identifier from a numeric for loop.
fn insert_local(
&mut self,
identifier: &mut String,
value: Option<&mut Expression>
)
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)
fn insert_local_function(&mut self, function: &mut LocalFunctionStatement)
Called when a new local function is initialized.