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

31 lines
673 B
Rust

use crate::ast::*;
pub struct ScopeResolver {
}
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(())
}
}