From 0b57561114ed7e1670739d60aeec169a58d6d9da Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 25 Sep 2019 01:45:02 -0700 Subject: [PATCH] Use block in scope resolution --- schala-lang/language/src/scope_resolution.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/schala-lang/language/src/scope_resolution.rs b/schala-lang/language/src/scope_resolution.rs index 66377f7..917f4c0 100644 --- a/schala-lang/language/src/scope_resolution.rs +++ b/schala-lang/language/src/scope_resolution.rs @@ -17,13 +17,7 @@ impl<'a> ScopeResolver<'a> { ScopeResolver { symbol_table, name_scope_stack } } pub fn resolve(&mut self, ast: &mut AST) -> Result<(), String> { - for statement in ast.statements.iter() { - match statement.kind { - StatementKind::Declaration(ref decl) => self.decl(decl), - StatementKind::Expression(ref expr) => self.expr(expr), - StatementKind::Import(ref spec) => self.import(spec), - }?; - } + self.block(&mut ast.statements)?; Ok(()) } @@ -64,7 +58,7 @@ impl<'a> ScopeResolver<'a> { match statement.kind { StatementKind::Declaration(ref decl) => self.decl(decl), StatementKind::Expression(ref expr) => self.expr(expr), - StatementKind::Import(_) => Ok(()) + StatementKind::Import(ref spec) => self.import(spec), }?; } Ok(())