forked from M-Labs/nac3
1
0
Fork 0

nac3core: composer better error msg in for uninit field

This commit is contained in:
ychenfo 2021-11-12 02:25:53 +08:00
parent aae9925014
commit 01b51b62ee
1 changed files with 8 additions and 5 deletions

View File

@ -1646,11 +1646,14 @@ impl TopLevelComposer {
unreachable!("must be init function here") unreachable!("must be init function here")
} }
let all_inited = Self::get_all_assigned_field(body.as_slice())?; let all_inited = Self::get_all_assigned_field(body.as_slice())?;
if fields.iter().any(|x| !all_inited.contains(&x.0)) { for (f, _, _) in fields {
return Err(format!( if !all_inited.contains(f) {
"fields of class {} not fully initialized", return Err(format!(
class_name "fields `{}` of class `{}` not fully initialized",
)); f,
class_name
));
}
} }
} }
} }