Start porting ScopeResolution to use Visitor pattern
This commit is contained in:
parent
77cc1f3824
commit
98e53a6d0f
@ -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(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user