Do not exit on first loop.

This commit is contained in:
Tom Alexander 2023-10-11 18:59:13 -04:00
parent 51429e3155
commit efc6bd11d9
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -460,6 +460,8 @@ pub(crate) fn compare_property_list_of_list_of_list_of_ast_nodes<
(Some(value), Some(rust_value)) => (value, rust_value), (Some(value), Some(rust_value)) => (value, rust_value),
}; };
let mut child_status: Vec<DiffEntry<'b, 's>> = Vec::with_capacity(rust_value.len());
// Iterate the outer lists // Iterate the outer lists
for (value, (rust_optional, rust_value)) in value.iter().zip(rust_value.iter()) { for (value, (rust_optional, rust_value)) in value.iter().zip(rust_value.iter()) {
let mut middle_value = value.as_list()?.iter(); let mut middle_value = value.as_list()?.iter();
@ -476,7 +478,6 @@ pub(crate) fn compare_property_list_of_list_of_list_of_ast_nodes<
return Ok(ComparePropertiesResult::SelfChange(this_status, message)); return Ok(ComparePropertiesResult::SelfChange(this_status, message));
} }
}; };
let mut child_status: Vec<DiffEntry<'b, 's>> = Vec::with_capacity(rust_value.len());
// Compare optional value // Compare optional value
if let Some(rust_optional) = rust_optional { if let Some(rust_optional) = rust_optional {
@ -489,6 +490,7 @@ pub(crate) fn compare_property_list_of_list_of_list_of_ast_nodes<
return Ok(ComparePropertiesResult::SelfChange(this_status, message)); return Ok(ComparePropertiesResult::SelfChange(this_status, message));
} }
for (e, r) in middle_value.zip(rust_optional) { for (e, r) in middle_value.zip(rust_optional) {
eprintln!("Comparing optval! {:?} {:?}", e, r);
child_status.push(compare_ast_node(source, e, r.into())?); child_status.push(compare_ast_node(source, e, r.into())?);
} }
} }
@ -504,12 +506,16 @@ pub(crate) fn compare_property_list_of_list_of_list_of_ast_nodes<
return Ok(ComparePropertiesResult::SelfChange(this_status, message)); return Ok(ComparePropertiesResult::SelfChange(this_status, message));
} }
for (e, r) in mandatory_value.iter().zip(rust_value) { for (e, r) in mandatory_value.iter().zip(rust_value) {
eprintln!("Comparing mandatory! {:?} {:?}", e, r);
child_status.push(compare_ast_node(source, e, r.into())?); child_status.push(compare_ast_node(source, e, r.into())?);
} }
let diff_scope = artificial_owned_diff_scope(emacs_field, child_status)?;
return Ok(ComparePropertiesResult::DiffEntry(diff_scope));
} }
Ok(ComparePropertiesResult::NoChange) if child_status.is_empty() {
Ok(ComparePropertiesResult::NoChange)
} else {
let diff_scope = artificial_owned_diff_scope(emacs_field, child_status)?;
Ok(ComparePropertiesResult::DiffEntry(diff_scope))
}
} }
pub(crate) fn compare_property_number_lines< pub(crate) fn compare_property_number_lines<