Trait budvm::ir::Scope

source ·
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§

source

type Environment: Environment

The environment for this scope.

This is used when instantiating literals as values.

Required Methods§

source

fn resolve_function_vtable_index(&self, name: &Symbol) -> Option<usize>

Returns the vtable index of a function with the provided name.

source

fn map_each_symbol(&self, callback: &mut impl FnMut(Symbol, ScopeSymbolKind))

Invokes callback for each symbol defined in this scope.

source

fn define_function( &mut self, function: Function<<Self::Environment as Environment>::Intrinsic> ) -> Option<usize>

Defines a function with the provided name.

source

fn define_persistent_variable(&mut self, name: Symbol, variable: Variable)

Defines a persistent variable.

This is used to enable interactive sessions.

Implementations on Foreign Types§

source§

impl Scope for ()

§

type Environment = ()

source§

fn resolve_function_vtable_index(&self, _name: &Symbol) -> Option<usize>

source§

fn map_each_symbol(&self, _callback: &mut impl FnMut(Symbol, ScopeSymbolKind))

source§

fn define_function(&mut self, _function: Function<Noop>) -> Option<usize>

source§

fn define_persistent_variable(&mut self, _name: Symbol, _variable: Variable)

Implementors§

source§

impl<Env> Scope for VirtualMachine<Env>where Env: Environment,

§

type Environment = Env