From 77cc1f382453d52eeb60b286038cbfecb747e85b Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 15 Oct 2019 19:02:48 -0700 Subject: [PATCH] ASTVisitor imports --- schala-lang/language/src/ast.rs | 2 ++ schala-lang/language/src/ast/visitor_test.rs | 2 +- schala-lang/language/src/ast/walker.rs | 2 +- schala-lang/language/src/scope_resolution.rs | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/schala-lang/language/src/ast.rs b/schala-lang/language/src/ast.rs index c362442..55da055 100644 --- a/schala-lang/language/src/ast.rs +++ b/schala-lang/language/src/ast.rs @@ -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)] diff --git a/schala-lang/language/src/ast/visitor_test.rs b/schala-lang/language/src/ast/visitor_test.rs index f835f1f..7c92a7a 100644 --- a/schala-lang/language/src/ast/visitor_test.rs +++ b/schala-lang/language/src/ast/visitor_test.rs @@ -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); diff --git a/schala-lang/language/src/ast/walker.rs b/schala-lang/language/src/ast/walker.rs index 112297b..d54cc05 100644 --- a/schala-lang/language/src/ast/walker.rs +++ b/schala-lang/language/src/ast/walker.rs @@ -4,7 +4,7 @@ use crate::ast::*; use crate::ast::visitor::ASTVisitor; use crate::util::deref_optional_box; -pub fn ast(v: &mut V, ast: &AST) { +pub fn walk_ast(v: &mut V, ast: &AST) { v.ast(ast); walk_block(v, &ast.statements); } diff --git a/schala-lang/language/src/scope_resolution.rs b/schala-lang/language/src/scope_resolution.rs index 443ccff..58bb8e7 100644 --- a/schala-lang/language/src/scope_resolution.rs +++ b/schala-lang/language/src/scope_resolution.rs @@ -12,6 +12,7 @@ pub struct ScopeResolver<'a> { name_scope_stack: ScopeStack<'a, Rc, FQSNPrefix>, } + impl<'a> ScopeResolver<'a> { pub fn new(symbol_table: &'a mut SymbolTable) -> ScopeResolver { let name_scope_stack = ScopeStack::new(None);