ExprContext

Trait ExprContext 

Source
pub trait ExprContext<T = DefaultTypeSet>
where T: TypeSet,
{ // Required methods fn type_context(&mut self) -> &mut T; fn try_load_variable(&mut self, variable: &str) -> Option<TypedValue<T>>; fn declare(&mut self, variable: &str, value: TypedValue<T>); fn assign_variable( &mut self, variable: &str, value: &TypedValue<T>, ) -> Result<(), Box<str>>; fn at_address( &mut self, address: TypedValue<T>, ) -> Result<TypedValue<T>, Box<str>>; fn assign_address( &mut self, address: TypedValue<T>, value: &TypedValue<T>, ) -> Result<(), Box<str>>; fn address_of(&mut self, variable: &str) -> TypedValue<T>; fn open_scope(&mut self); fn close_scope(&mut self); fn call_function( &mut self, function_name: &str, args: &[TypedValue<T>], ) -> Result<TypedValue<T>, FunctionCallError>; }
Expand description

An expression context that provides the necessary environment for evaluating expressions.

Required Methods§

Source

fn type_context(&mut self) -> &mut T

Returns a reference to the TypeSet.

Source

fn try_load_variable(&mut self, variable: &str) -> Option<TypedValue<T>>

Attempts to load a variable from the context.

Source

fn declare(&mut self, variable: &str, value: TypedValue<T>)

Declares a variable in the context.

Source

fn assign_variable( &mut self, variable: &str, value: &TypedValue<T>, ) -> Result<(), Box<str>>

Assigns a new value to a variable in the context.

Source

fn at_address( &mut self, address: TypedValue<T>, ) -> Result<TypedValue<T>, Box<str>>

Returns a value from the given address.

Source

fn assign_address( &mut self, address: TypedValue<T>, value: &TypedValue<T>, ) -> Result<(), Box<str>>

Assigns a new value to a variable in the context.

Source

fn address_of(&mut self, variable: &str) -> TypedValue<T>

Returns the address of a variable in the context.

Source

fn open_scope(&mut self)

Opens a new scope in the current stack frame.

Source

fn close_scope(&mut self)

Closes the last scope in the current stack frame.

Source

fn call_function( &mut self, function_name: &str, args: &[TypedValue<T>], ) -> Result<TypedValue<T>, FunctionCallError>

Calls a function in the context.

Implementors§

Source§

impl<T> ExprContext<T> for Context<'_, T>
where T: TypeSet,