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")
}
let all_inited = Self::get_all_assigned_field(body.as_slice())?;
if fields.iter().any(|x| !all_inited.contains(&x.0)) {
return Err(format!(
"fields of class {} not fully initialized",
class_name
));
for (f, _, _) in fields {
if !all_inited.contains(f) {
return Err(format!(
"fields `{}` of class `{}` not fully initialized",
f,
class_name
));
}
}
}
}