ASTVisitor imports

This commit is contained in:
greg 2019-10-15 19:02:48 -07:00
parent 9e64a22328
commit 77cc1f3824
4 changed files with 5 additions and 2 deletions

View File

@ -7,6 +7,8 @@ mod visitor;
mod visitor_test;
mod operators;
pub use operators::*;
pub use visitor::ASTVisitor;
pub use walker::walk_ast;
/// An abstract identifier for an AST node
#[derive(Debug, PartialEq, Eq, Hash, Clone)]

View File

@ -34,7 +34,7 @@ fn heh() {
"#);
walker::ast(&mut tester, &ast);
walker::walk_ast(&mut tester, &ast);
assert_eq!(tester.count, 6);
assert_eq!(tester.float_count, 1);

View File

@ -4,7 +4,7 @@ use crate::ast::*;
use crate::ast::visitor::ASTVisitor;
use crate::util::deref_optional_box;
pub fn ast<V: ASTVisitor>(v: &mut V, ast: &AST) {
pub fn walk_ast<V: ASTVisitor>(v: &mut V, ast: &AST) {
v.ast(ast);
walk_block(v, &ast.statements);
}

View File

@ -12,6 +12,7 @@ pub struct ScopeResolver<'a> {
name_scope_stack: ScopeStack<'a, Rc<String>, FQSNPrefix>,
}
impl<'a> ScopeResolver<'a> {
pub fn new(symbol_table: &'a mut SymbolTable) -> ScopeResolver {
let name_scope_stack = ScopeStack::new(None);