Locals

Trait Locals 

Source
pub trait Locals {
    // Required methods
    fn open(&mut self, frame: StackFrame);
    fn close(&mut self);
    fn fetch(&self, id: &Identifier) -> EvalResult<Symbol>;
    fn set_local_value(
        &mut self,
        id: Identifier,
        value: Value,
    ) -> EvalResult<()>;
    fn get_local_value(&self, id: &Identifier) -> EvalResult<Value>;
    fn get_model(&self) -> EvalResult<Model>;
    fn current_name(&self) -> QualifiedName;
}
Expand description

Trait to manage the locals.

The locals manage the state about where evaluation is currently processing the source code.

Items on the local stack can be of different types:

  • a source file with an own local stack frame,
  • a body (surrounded by curly brackets {}),
  • a module without local variables but aliases (use statements), or
  • a call without local variables.

Each one may have different items it stores (see StackFrame).

Required Methods§

Source

fn open(&mut self, frame: StackFrame)

Don’t use this function directly.

Source

fn close(&mut self)

Close scope (stack pop).

Source

fn fetch(&self, id: &Identifier) -> EvalResult<Symbol>

Fetch a local variable from current stack frame.

Source

fn set_local_value(&mut self, id: Identifier, value: Value) -> EvalResult<()>

Set/add a named local value to current locals.

Source

fn get_local_value(&self, id: &Identifier) -> EvalResult<Value>

Get a named local value from locals.

Source

fn get_model(&self) -> EvalResult<Model>

Get a property value from current model.

Source

fn current_name(&self) -> QualifiedName

Return qualified name of current module or workbench.

Implementors§