Struct passerine::compiler::hoist::Hoister [−][src]
pub struct Hoister { /* fields omitted */ }
Expand description
Keeps track of:
- Local and nonlocal variables in each scope.
- All variables declared.
- Variables that have been used but not declared.
Implementations
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>
pub fn walk_pattern(
&mut self,
pattern: Spanned<CSTPattern>,
declare: bool
) -> Spanned<SSTPattern>
Walks a pattern. If declare
is true, we shadow variables in existing scopes
and creates a new variable in the local scope.
Replaces a symbol name with a unique identifier for that symbol
Walks a block, nothing fancy here.
Walks a tuple, nothing fancy here.
Walks an assignment.
Delegates to walk_pattern
for capturing.
Assignments can capture existing variables
Walks a function definition.
Like assign
, delegates to walk_pattern
for capturing.
But any paramaters will shadow those in outer scopes.