pub struct Frame<'scope> { /* private fields */ }Expand description
Represents a stack frame
Implementations§
Source§impl<'scope> Frame<'scope>
impl<'scope> Frame<'scope>
pub fn pop_values(self) -> Option<StackFrame>
pub fn into_binds(self) -> Option<StackBinds>
Methods from Deref<Target = Environment>§
Sourcepub fn eval(&mut self, node: &impl Interpret) -> IResult<ConValue>
pub fn eval(&mut self, node: &impl Interpret) -> IResult<ConValue>
Reflexively evaluates a node
Sourcepub fn call(&mut self, name: Sym, args: &[ConValue]) -> IResult<ConValue>
pub fn call(&mut self, name: Sym, args: &[ConValue]) -> IResult<ConValue>
Calls a function inside the Environment’s scope, and returns the result
pub fn modules_mut(&mut self) -> &mut ModuleTree
pub fn modules(&self) -> &ModuleTree
Sourcepub fn bind(&mut self, name: impl Into<Sym>, value: impl Into<ConValue>)
pub fn bind(&mut self, name: impl Into<Sym>, value: impl Into<ConValue>)
Binds a value to the given name in the current scope.
pub fn bind_raw(&mut self, name: Sym, id: usize) -> Option<()>
Sourcepub fn add_builtins(&mut self, builtins: &'static [Builtin]) -> &mut Self
pub fn add_builtins(&mut self, builtins: &'static [Builtin]) -> &mut Self
pub fn push_frame(&mut self, name: &'static str, frame: StackFrame)
pub fn pop_frame(&mut self) -> Option<(StackFrame, &'static str)>
Sourcepub fn frame(&mut self, name: &'static str) -> Frame<'_>
pub fn frame(&mut self, name: &'static str) -> Frame<'_>
Enters a nested scope, returning a Frame stack-guard.
Frame implements Deref/DerefMut for Environment.
Sourcepub fn with_frame<'e>(
&'e mut self,
name: &'static str,
frame: StackFrame,
) -> Frame<'e>
pub fn with_frame<'e>( &'e mut self, name: &'static str, frame: StackFrame, ) -> Frame<'e>
Enters a nested scope, assigning the contents of frame,
and returning a Frame stack-guard.
Frame implements Deref/DerefMut for Environment.
Sourcepub fn get_mut(&mut self, name: Sym) -> IResult<&mut ConValue>
pub fn get_mut(&mut self, name: Sym) -> IResult<&mut ConValue>
Resolves a variable mutably.
Returns a mutable reference to the variable’s record, if it exists.
Sourcepub fn get(&self, name: Sym) -> IResult<ConValue>
pub fn get(&self, name: Sym) -> IResult<ConValue>
Resolves a variable immutably.
Returns a reference to the variable’s contents, if it is defined and initialized.
pub fn get_id(&self, id: usize) -> Option<&ConValue>
pub fn get_id_mut(&mut self, id: usize) -> Option<&mut ConValue>
pub fn get_slice(&self, start: usize, len: usize) -> Option<&[ConValue]>
pub fn get_slice_mut( &mut self, start: usize, len: usize, ) -> Option<&mut [ConValue]>
Sourcepub fn insert(&mut self, k: Sym, v: ConValue)
pub fn insert(&mut self, k: Sym, v: ConValue)
Inserts a new ConValue into this Environment
Sourcepub fn insert_fn(&mut self, decl: &FnDecl)
pub fn insert_fn(&mut self, decl: &FnDecl)
A convenience function for registering a [FnDecl] as a Function
pub fn insert_tup_constructor(&mut self, name: Sym, arity: usize)
Sourcepub fn stack_alloc(&mut self, value: ConValue) -> IResult<usize>
pub fn stack_alloc(&mut self, value: ConValue) -> IResult<usize>
Allocates a local variable