Start porting ScopeResolution to use Visitor pattern

This commit is contained in:
greg 2019-10-15 19:06:07 -07:00
parent 77cc1f3824
commit 98e53a6d0f
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,11 @@ pub struct ScopeResolver<'a> {
name_scope_stack: ScopeStack<'a, Rc<String>, FQSNPrefix>,
}
impl<'a> ASTVisitor for ScopeResolver<'a> {
fn ast(&mut self, _ast: &AST) {
println!("VISITING AST!!!");
}
}
impl<'a> ScopeResolver<'a> {
pub fn new(symbol_table: &'a mut SymbolTable) -> ScopeResolver {
@ -19,6 +24,7 @@ impl<'a> ScopeResolver<'a> {
ScopeResolver { symbol_table, name_scope_stack }
}
pub fn resolve(&mut self, ast: &mut AST) -> Result<(), String> {
walk_ast(self, ast);
self.block(&mut ast.statements)?;
Ok(())
}