Use block in scope resolution

This commit is contained in:
greg 2019-09-25 01:45:02 -07:00
parent dbd81ca83d
commit 0b57561114

View File

@ -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(())