Add local variable collection to compilation
* Upon entering a new body, the local scope variables are collected. * VM instruction PushLocal now uses a `Local` value instead of a `Sym` value * Compilation of a new AST body will implicitly create a new scope Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -50,7 +50,3 @@ impl Visit for CollectLocals<'_, '_> {
|
||||
fn visit_access_expr(&mut self, expr: &AccessExpr) -> Self::Out { DefaultAccept::default_accept(expr, self); }
|
||||
fn visit_atom(&mut self, atom: &Atom) -> Self::Out { DefaultAccept::default_accept(atom, self); }
|
||||
}
|
||||
|
||||
pub fn collect_locals(compile: &mut Compile, body: &Body) {
|
||||
CollectLocals::new(compile).collect(body);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user