mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-01 21:21:10 +00:00
Fix #272
This commit is contained in:
parent
f21715c8c1
commit
4a0143302f
3 changed files with 15 additions and 0 deletions
|
@ -950,6 +950,12 @@ impl Context {
|
|||
self.kind = kind;
|
||||
}
|
||||
|
||||
pub(crate) fn clear_invalid_vars(&mut self) {
|
||||
self.locals.retain(|_, v| v.t != Failure);
|
||||
self.decls.retain(|_, v| v.t != Failure);
|
||||
self.params.retain(|(_, v)| v.t != Failure);
|
||||
}
|
||||
|
||||
pub fn pop(&mut self) -> Context {
|
||||
if let Some(parent) = self.outer.as_mut() {
|
||||
let parent = mem::take(parent);
|
||||
|
|
|
@ -1978,6 +1978,7 @@ impl ASTLowerer {
|
|||
}
|
||||
}
|
||||
}
|
||||
self.ctx.clear_invalid_vars();
|
||||
self.ctx.check_decls().unwrap_or_else(|mut errs| {
|
||||
self.errs.append(&mut errs);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue