Struct passerine::compiler::hoist::Hoister[][src]

pub struct Hoister { /* fields omitted */ }

Keeps track of:

  1. Local and nonlocal variables in each scope.
  2. All variables declared.
  3. Variables that have been used but not declared.

Implementations

impl Hoister[src]

pub fn new() -> Hoister[src]

Creates a new hoisted in a root scope. Note that the hoister will always have a root scope.

pub fn walk(&mut self, cst: Spanned<CST>) -> Result<Spanned<SST>, Syntax>[src]

Walks a CST to produce an SST. This is fairly standard - hoisting happens in self.assign, self.lambda, and self.symbol.

pub fn walk_pattern(
    &mut self,
    pattern: Spanned<CSTPattern>,
    declare: bool
) -> Spanned<SSTPattern>
[src]

Walks a pattern. If declare is true, we shadow variables in existing scopes and creates a new variable in the local scope.

pub fn symbol(&mut self, name: &str) -> SST[src]

Replaces a symbol name with a unique identifier for that symbol

pub fn block(&mut self, block: Vec<Spanned<CST>>) -> Result<SST, Syntax>[src]

Walks a block, nothing fancy here.

pub fn tuple(&mut self, tuple: Vec<Spanned<CST>>) -> Result<SST, Syntax>[src]

Walks a tuple, nothing fancy here.

pub fn assign(
    &mut self,
    pattern: Spanned<CSTPattern>,
    expression: Spanned<CST>
) -> Result<SST, Syntax>
[src]

Walks an assignment. Delegates to walk_pattern for capturing. Assignments can capture existing variables

pub fn lambda(
    &mut self,
    pattern: Spanned<CSTPattern>,
    expression: Spanned<CST>
) -> Result<SST, Syntax>
[src]

Walks a function definition. Like assign, delegates to walk_pattern for capturing. But any paramaters will shadow those in outer scopes.

pub fn call(
    &mut self,
    fun: Spanned<CST>,
    arg: Spanned<CST>
) -> Result<SST, Syntax>
[src]

Walks a function call.

Auto Trait Implementations

impl RefUnwindSafe for Hoister

impl Send for Hoister

impl Sync for Hoister

impl Unpin for Hoister

impl UnwindSafe for Hoister

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, 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.