Compare the additional properties.
This commit is contained in:
parent
f050e9b6a8
commit
d552ef6569
@ -63,6 +63,8 @@ mod underline;
|
||||
mod verbatim;
|
||||
mod verse_block;
|
||||
|
||||
pub use additional_property::AdditionalProperties;
|
||||
pub use additional_property::AdditionalPropertyValue;
|
||||
pub use ast_node::WasmAstNode;
|
||||
pub use document::WasmDocument;
|
||||
pub(crate) use headline::WasmHeadline;
|
||||
|
@ -6,6 +6,8 @@ use crate::compare::get_property_quoted_string;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::compare::EmacsField;
|
||||
use crate::compare::Token;
|
||||
use crate::wasm::AdditionalProperties;
|
||||
use crate::wasm::AdditionalPropertyValue;
|
||||
use crate::wasm::WasmAstNode;
|
||||
use crate::wasm::WasmDocument;
|
||||
use crate::wasm::WasmHeadline;
|
||||
@ -416,3 +418,35 @@ fn wasm_compare_standard_properties<'b, 's>(
|
||||
result.children.push(layer);
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn wasm_compare_additional_properties<'b, 's>(
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
wasm: &AdditionalProperties<'_, '_>,
|
||||
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut result = WasmDiffResult::default();
|
||||
let mut layer = WasmDiffResult::default();
|
||||
layer.name = "additional-properties".into();
|
||||
|
||||
for (property_name, property_value) in wasm.properties.iter() {
|
||||
let emacs_property_name = format!(":{property_name}", property_name = property_name);
|
||||
match property_value {
|
||||
AdditionalPropertyValue::SingleString(wasm_value) => {
|
||||
layer.extend(wasm_compare_property_quoted_string(
|
||||
source,
|
||||
emacs,
|
||||
wasm,
|
||||
&emacs_property_name,
|
||||
|_| Some(wasm_value),
|
||||
)?)?;
|
||||
}
|
||||
// TODO: similar to compare_affiliated_keywords
|
||||
AdditionalPropertyValue::ListOfStrings(_) => todo!(),
|
||||
AdditionalPropertyValue::OptionalPair { optval, val } => todo!(),
|
||||
AdditionalPropertyValue::ObjectTree(_) => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
result.children.push(layer);
|
||||
Ok(result)
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ macro_rules! wasm_compare {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result.extend(wasm_compare_additional_properties($source, $emacs, &$wasm.additional_properties)?)?;
|
||||
}
|
||||
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user