hm-inference #6

Merged
sb10q merged 136 commits from hm-inference into master 2021-08-19 11:46:50 +08:00
1 changed files with 14 additions and 1 deletions
Showing only changes of commit 1d13b16f94 - Show all commits

View File

@ -132,6 +132,7 @@ impl<'a> Inferencer<'a> {
Ok(()) Ok(())
} }
// check statements for proper identifier def-use and return on all paths
fn check_stmt( fn check_stmt(
&mut self, &mut self,
stmt: &Stmt<Option<Type>>, stmt: &Stmt<Option<Type>>,
@ -195,7 +196,19 @@ impl<'a> Inferencer<'a> {
} }
Ok(false) Ok(false)
} }
// break, return, raise, etc. StmtKind::Return { value } => {
if let Some(value) = value {
self.check_expr(value, defined_identifiers)?;
}
Ok(true)
}
StmtKind::Raise { exc, .. } => {
if let Some(value) = exc {
self.check_expr(value, defined_identifiers)?;
}
Ok(true)
}
// break, raise, etc.
_ => Ok(false), _ => Ok(false),
} }
} }