pub trait Scope {
type Environment: Environment;
// Required methods
fn resolve_function_vtable_index(&self, name: &Symbol) -> Option<usize>;
fn map_each_symbol(&self, callback: &mut impl FnMut(Symbol, ScopeSymbolKind));
fn define_function(
&mut self,
function: Function<<Self::Environment as Environment>::Intrinsic>
) -> Option<usize>;
fn define_persistent_variable(&mut self, name: Symbol, variable: Variable);
}
Expand description
A scope for linking and compiling code.
Required Associated Types§
sourcetype Environment: Environment
type Environment: Environment
The environment for this scope.
This is used when instantiating literals as values.
Required Methods§
sourcefn resolve_function_vtable_index(&self, name: &Symbol) -> Option<usize>
fn resolve_function_vtable_index(&self, name: &Symbol) -> Option<usize>
Returns the vtable index of a function with the provided name.
sourcefn map_each_symbol(&self, callback: &mut impl FnMut(Symbol, ScopeSymbolKind))
fn map_each_symbol(&self, callback: &mut impl FnMut(Symbol, ScopeSymbolKind))
Invokes callback
for each symbol defined in this scope.
sourcefn define_function(
&mut self,
function: Function<<Self::Environment as Environment>::Intrinsic>
) -> Option<usize>
fn define_function( &mut self, function: Function<<Self::Environment as Environment>::Intrinsic> ) -> Option<usize>
Defines a function with the provided name.
sourcefn define_persistent_variable(&mut self, name: Symbol, variable: Variable)
fn define_persistent_variable(&mut self, name: Symbol, variable: Variable)
Defines a persistent variable.
This is used to enable interactive sessions.