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§
Sourcefn type_context(&mut self) -> &mut T
fn type_context(&mut self) -> &mut T
Returns a reference to the TypeSet.
Sourcefn try_load_variable(&mut self, variable: &str) -> Option<TypedValue<T>>
fn try_load_variable(&mut self, variable: &str) -> Option<TypedValue<T>>
Attempts to load a variable from the context.
Sourcefn declare(&mut self, variable: &str, value: TypedValue<T>)
fn declare(&mut self, variable: &str, value: TypedValue<T>)
Declares a variable in the context.
Sourcefn assign_variable(
&mut self,
variable: &str,
value: &TypedValue<T>,
) -> Result<(), Box<str>>
fn assign_variable( &mut self, variable: &str, value: &TypedValue<T>, ) -> Result<(), Box<str>>
Assigns a new value to a variable in the context.
Sourcefn at_address(
&mut self,
address: TypedValue<T>,
) -> Result<TypedValue<T>, Box<str>>
fn at_address( &mut self, address: TypedValue<T>, ) -> Result<TypedValue<T>, Box<str>>
Returns a value from the given address.
Sourcefn assign_address(
&mut self,
address: TypedValue<T>,
value: &TypedValue<T>,
) -> Result<(), Box<str>>
fn assign_address( &mut self, address: TypedValue<T>, value: &TypedValue<T>, ) -> Result<(), Box<str>>
Assigns a new value to a variable in the context.
Sourcefn address_of(&mut self, variable: &str) -> TypedValue<T>
fn address_of(&mut self, variable: &str) -> TypedValue<T>
Returns the address of a variable in the context.
Sourcefn open_scope(&mut self)
fn open_scope(&mut self)
Opens a new scope in the current stack frame.
Sourcefn close_scope(&mut self)
fn close_scope(&mut self)
Closes the last scope in the current stack frame.
Sourcefn call_function(
&mut self,
function_name: &str,
args: &[TypedValue<T>],
) -> Result<TypedValue<T>, FunctionCallError>
fn call_function( &mut self, function_name: &str, args: &[TypedValue<T>], ) -> Result<TypedValue<T>, FunctionCallError>
Calls a function in the context.