Use block in scope resolution
This commit is contained in:
parent
dbd81ca83d
commit
0b57561114
@ -17,13 +17,7 @@ impl<'a> ScopeResolver<'a> {
|
|||||||
ScopeResolver { symbol_table, name_scope_stack }
|
ScopeResolver { symbol_table, name_scope_stack }
|
||||||
}
|
}
|
||||||
pub fn resolve(&mut self, ast: &mut AST) -> Result<(), String> {
|
pub fn resolve(&mut self, ast: &mut AST) -> Result<(), String> {
|
||||||
for statement in ast.statements.iter() {
|
self.block(&mut ast.statements)?;
|
||||||
match statement.kind {
|
|
||||||
StatementKind::Declaration(ref decl) => self.decl(decl),
|
|
||||||
StatementKind::Expression(ref expr) => self.expr(expr),
|
|
||||||
StatementKind::Import(ref spec) => self.import(spec),
|
|
||||||
}?;
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +58,7 @@ impl<'a> ScopeResolver<'a> {
|
|||||||
match statement.kind {
|
match statement.kind {
|
||||||
StatementKind::Declaration(ref decl) => self.decl(decl),
|
StatementKind::Declaration(ref decl) => self.decl(decl),
|
||||||
StatementKind::Expression(ref expr) => self.expr(expr),
|
StatementKind::Expression(ref expr) => self.expr(expr),
|
||||||
StatementKind::Import(_) => Ok(())
|
StatementKind::Import(ref spec) => self.import(spec),
|
||||||
}?;
|
}?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user