ASTVisitor imports
This commit is contained in:
parent
9e64a22328
commit
77cc1f3824
@ -7,6 +7,8 @@ mod visitor;
|
|||||||
mod visitor_test;
|
mod visitor_test;
|
||||||
mod operators;
|
mod operators;
|
||||||
pub use operators::*;
|
pub use operators::*;
|
||||||
|
pub use visitor::ASTVisitor;
|
||||||
|
pub use walker::walk_ast;
|
||||||
|
|
||||||
/// An abstract identifier for an AST node
|
/// An abstract identifier for an AST node
|
||||||
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||||
|
@ -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.count, 6);
|
||||||
assert_eq!(tester.float_count, 1);
|
assert_eq!(tester.float_count, 1);
|
||||||
|
@ -4,7 +4,7 @@ use crate::ast::*;
|
|||||||
use crate::ast::visitor::ASTVisitor;
|
use crate::ast::visitor::ASTVisitor;
|
||||||
use crate::util::deref_optional_box;
|
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);
|
v.ast(ast);
|
||||||
walk_block(v, &ast.statements);
|
walk_block(v, &ast.statements);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ pub struct ScopeResolver<'a> {
|
|||||||
name_scope_stack: ScopeStack<'a, Rc<String>, FQSNPrefix>,
|
name_scope_stack: ScopeStack<'a, Rc<String>, FQSNPrefix>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<'a> ScopeResolver<'a> {
|
impl<'a> ScopeResolver<'a> {
|
||||||
pub fn new(symbol_table: &'a mut SymbolTable) -> ScopeResolver {
|
pub fn new(symbol_table: &'a mut SymbolTable) -> ScopeResolver {
|
||||||
let name_scope_stack = ScopeStack::new(None);
|
let name_scope_stack = ScopeStack::new(None);
|
||||||
|
Loading…
Reference in New Issue
Block a user