schala/schala-lang/language/src/scope_resolution.rs

31 lines
673 B
Rust
Raw Normal View History

2019-09-03 01:42:28 -07:00
use crate::ast::*;
2019-09-03 02:59:19 -07:00
pub struct ScopeResolver {
2019-09-03 02:19:37 -07:00
}
2019-09-03 02:59:19 -07:00
impl ScopeResolver {
pub fn new() -> ScopeResolver {
ScopeResolver { }
}
pub fn resolve(&mut self, ast: &mut AST) -> Result<(), String> {
println!("Resolving scopes - nothing so far!");
for statement in ast.0.iter_mut() {
match statement.mut_node() {
Statement::Declaration(ref mut decl) => self.decl(decl),
Statement::ExpressionStatement(ref mut expr) => self.expr(expr),
}?;
}
Ok(())
}
fn decl(&mut self, decl: &mut Declaration) -> Result<(), String> {
Ok(())
}
fn expr(&mut self, expr: &mut Meta<Expression>) -> Result<(), String> {
Ok(())
}
2019-09-03 01:42:28 -07:00
}