Assume :standard-properties is an expected field.

This commit is contained in:
Tom Alexander
2023-10-06 13:40:11 -04:00
parent 7af18e2312
commit 45dd38ac2d
4 changed files with 40 additions and 45 deletions

View File

@@ -1,9 +1,3 @@
#[derive(Debug)]
pub(crate) enum EmacsField<'s> {
Required(&'s str),
Optional(&'s str),
}
/// Create iterators for ast nodes where it only has to iterate over children
macro_rules! compare_properties {
($emacs:expr, $($emacs_field:expr, $rust_value:expr, $compare_fn: ident),+) => {
@@ -16,7 +10,7 @@ macro_rules! compare_properties {
.nth(1)
.ok_or("Should have an attributes child.")?;
let attributes_map = attributes_child.as_map()?;
let mut emacs_keys: BTreeSet<&str> = attributes_map.keys().map(|s| *s).collect();
let mut emacs_keys: BTreeSet<&str> = attributes_map.keys().map(|s| *s).filter(|s| *s != ":standard-properties").collect();
$(
match $emacs_field {
EmacsField::Required(name) if emacs_keys.contains(name) => {