compare_properties table row.
This commit is contained in:
parent
62815621e4
commit
cf257443b0
@ -1750,28 +1750,40 @@ fn compare_table_row<'b, 's>(
|
|||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'b TableRow<'s>,
|
rust: &'b TableRow<'s>,
|
||||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||||
let children = emacs.as_list()?;
|
|
||||||
let mut child_status = Vec::new();
|
|
||||||
let mut this_status = DiffStatus::Good;
|
let mut this_status = DiffStatus::Good;
|
||||||
|
let mut child_status = Vec::new();
|
||||||
let mut message = None;
|
let mut message = None;
|
||||||
|
|
||||||
// Compare type
|
compare_children(
|
||||||
let row_type = get_property_unquoted_atom(emacs, ":type")?;
|
source,
|
||||||
let rust_row_type = rust.get_type();
|
emacs,
|
||||||
match (row_type, &rust_row_type) {
|
&rust.children,
|
||||||
(Some("standard"), TableRowType::Standard) => {}
|
&mut child_status,
|
||||||
(Some("rule"), TableRowType::Rule) => {}
|
&mut this_status,
|
||||||
_ => {
|
&mut message,
|
||||||
this_status = DiffStatus::Bad;
|
)?;
|
||||||
message = Some(format!(
|
|
||||||
"Type mismatch (emacs != rust) {:?} != {:?}",
|
|
||||||
row_type, rust_row_type
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {
|
for diff in compare_properties!(
|
||||||
child_status.push(compare_ast_node(source, emacs_child, rust_child.into())?);
|
source,
|
||||||
|
emacs,
|
||||||
|
rust,
|
||||||
|
(
|
||||||
|
EmacsField::Required(":type"),
|
||||||
|
|r| Some(match r.get_type() {
|
||||||
|
TableRowType::Standard => "standard",
|
||||||
|
TableRowType::Rule => "rule",
|
||||||
|
}),
|
||||||
|
compare_property_unquoted_atom
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
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 {
|
Ok(DiffResult {
|
||||||
|
Loading…
Reference in New Issue
Block a user