Struct phoenix_lang::resolver::Resolver
source · pub struct Resolver { /* private fields */ }Expand description
Manages the declaration and definition of local variables
One ResolverNode is created and pushed onto the stack for each function definition. It then gets popped off once its definition ends, so the value on top of each ResolverNode on the stack will always be its parent
Normal resolution is handled by the current ResolverNode. Resolution that involves closures (upvalues) is done by the Resolver (since it will potentially involve many ResolverNodes)
Implementations§
source§impl Resolver
impl Resolver
sourcepub fn begin_scope(&mut self)
pub fn begin_scope(&mut self)
Calls this function on the current ResolverNode
sourcepub fn mark_initialized(&mut self)
pub fn mark_initialized(&mut self)
Calls this function on the current ResolverNode
sourcepub fn declare_variable(&mut self, x: String) -> bool
pub fn declare_variable(&mut self, x: String) -> bool
Calls this function on the current ResolverNode
sourcepub fn resolve_local(&mut self, x: &str) -> Option<Option<usize>>
pub fn resolve_local(&mut self, x: &str) -> Option<Option<usize>>
Calls this function on the current ResolverNode
sourcepub fn resolve_upvalue(&mut self, name: &str) -> Option<usize>
pub fn resolve_upvalue(&mut self, name: &str) -> Option<usize>
Calls Resolver::recursive_resolve to handle the flattening of upvalues
Returns the index of the UpValue in the upvalues Vec
sourcepub fn push(&mut self, fn_type: FunctionType)
pub fn push(&mut self, fn_type: FunctionType)
Push a new ResolverNode for the new function scope
sourcepub fn pop(&mut self) -> Vec<UpValue>
pub fn pop(&mut self) -> Vec<UpValue>
Remove the latest ResolverNode and return the UpValues resolved in that scope
pub fn new() -> Resolver
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Resolver
impl RefUnwindSafe for Resolver
impl Send for Resolver
impl Sync for Resolver
impl Unpin for Resolver
impl UnwindSafe for Resolver
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)