Add formatting, fix typechecking for associated functions
This commit is contained in:
parent
24f11a77d2
commit
4f57ed399f
@ -49,6 +49,9 @@ impl Display for Module {
|
||||
for typedef in &self.typedefs {
|
||||
writeln!(inner_f, "{}", typedef)?;
|
||||
}
|
||||
for (ty, fun) in &self.associated_functions {
|
||||
writeln!(inner_f, "(Assoc {}) {}", ty, fun)?;
|
||||
}
|
||||
for fun in &self.functions {
|
||||
writeln!(inner_f, "{}", fun)?;
|
||||
}
|
||||
|
@ -68,6 +68,11 @@ impl<'t> Pass for TypeCheck<'t> {
|
||||
state.ok(res, binop.block_meta().unwrap_or(binop.signature()));
|
||||
}
|
||||
|
||||
for (_, function) in &mut module.associated_functions {
|
||||
let res = function.typecheck(&self.refs, &mut state.inner());
|
||||
state.ok(res, function.block_meta());
|
||||
}
|
||||
|
||||
for function in &mut module.functions {
|
||||
let res = function.typecheck(&self.refs, &mut state.inner());
|
||||
state.ok(res, function.block_meta());
|
||||
|
@ -120,6 +120,11 @@ impl<'t> Pass for TypeInference<'t> {
|
||||
state.ok(res, binop.block_meta().unwrap_or(binop.signature()));
|
||||
}
|
||||
|
||||
for (_, function) in &mut module.associated_functions {
|
||||
let res = function.infer_types(&self.refs, &mut state.inner());
|
||||
state.ok(res, function.block_meta());
|
||||
}
|
||||
|
||||
for function in &mut module.functions {
|
||||
let res = function.infer_types(&self.refs, &mut state.inner());
|
||||
state.ok(res, function.block_meta());
|
||||
|
Loading…
Reference in New Issue
Block a user