compare_properties property drawer.

This commit is contained in:
Tom Alexander 2023-10-09 22:42:02 -04:00
parent 5b146d7c07
commit d1184fa1d0
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 20 additions and 5 deletions

View File

@ -1589,13 +1589,28 @@ fn compare_property_drawer<'b, 's>(
emacs: &'b Token<'s>,
rust: &'b PropertyDrawer<'s>,
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
let children = emacs.as_list()?;
let mut this_status = DiffStatus::Good;
let mut child_status = Vec::new();
let this_status = DiffStatus::Good;
let message = None;
let mut message = None;
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {
child_status.push(compare_ast_node(source, emacs_child, rust_child.into())?);
compare_children(
source,
emacs,
&rust.children,
&mut child_status,
&mut this_status,
&mut message,
)?;
for diff in compare_properties!(emacs) {
match diff {
ComparePropertiesResult::NoChange => {}
ComparePropertiesResult::SelfChange(new_status, new_message) => {
this_status = new_status;
message = new_message
}
ComparePropertiesResult::DiffEntry(diff_entry) => child_status.push(diff_entry),
}
}
Ok(DiffResult {