[][src]Struct wlambda::compiler::CompileEnv

pub struct CompileEnv {
    pub global: GlobalEnvRef,
    pub implicit_arity: (ArityParam, ArityParam),
    pub explicit_arity: (ArityParam, ArityParam),
    pub recent_var: String,
    pub recent_sym: String,
    pub quote_func: bool,
    // some fields omitted
}

Compile time environment for allocating and storing variables inside a function scope.

Also handles upvalues. Upvalues in WLambda are copied to every scope that they are passed through until they are needed.

Fields

global: GlobalEnvRef

Reference to the global environment

implicit_arity: (ArityParam, ArityParam)

Stores the implicitly calculated arity of this function.

explicit_arity: (ArityParam, ArityParam)

Stores the explicitly defined arity of this function.

recent_var: String

Recently accessed variable name:

recent_sym: String

Recently compiled symbol:

quote_func: bool

If set, the next compile() is compiling a function as block.

Implementations

impl CompileEnv[src]

pub fn new(g: GlobalEnvRef) -> Rc<RefCell<Self>>[src]

pub fn create_env(
    parent: Option<Rc<RefCell<CompileEnv>>>
) -> Rc<RefCell<CompileEnv>>
[src]

pub fn def_const(&mut self, s: &str, val: VVal)[src]

pub fn def_local(&mut self, s: &str, idx: usize)[src]

pub fn find_or_new_local(&mut self, var: &str) -> usize[src]

pub fn next_local(&mut self) -> usize[src]

pub fn get_local_space(&self) -> usize[src]

pub fn def(&mut self, s: &str, is_global: bool) -> VarPos[src]

pub fn get_upval_pos(&self) -> Vec<VarPos>[src]

pub fn local_env_size(&self) -> usize[src]

pub fn push_block_env(&mut self)[src]

pub fn pop_block_env(&mut self) -> (usize, usize)[src]

pub fn get(&mut self, s: &str) -> VarPos[src]

Trait Implementations

impl Clone for CompileEnv[src]

impl Debug for CompileEnv[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.