Standardize parameter order.
This commit is contained in:
parent
54085b5833
commit
037caf369c
@ -78,19 +78,19 @@ pub fn wasm_compare_document<'e, 's, 'w>(
|
||||
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let wasm_json = serde_json::to_string(&wasm)?;
|
||||
let wasm_json_parsed = serde_json::from_str(&wasm_json)?;
|
||||
compare_json_value(&wasm_json_parsed, source, emacs)
|
||||
compare_json_value(source, emacs, &wasm_json_parsed)
|
||||
}
|
||||
|
||||
fn compare_json_value<'b, 's>(
|
||||
value: &serde_json::Value,
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
wasm: &serde_json::Value,
|
||||
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
println!("XXXXXXXXXXXXXX compare_json_value XXXXXXXXXXXXXX");
|
||||
println!("{:?}", emacs);
|
||||
println!("{:?}", value);
|
||||
println!("{:?}", wasm);
|
||||
println!("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
|
||||
match (value, emacs) {
|
||||
match (wasm, emacs) {
|
||||
(serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("ast-node") => {
|
||||
// We hit a regular ast node.
|
||||
compare_ast_node(source, el, wasm)
|
||||
@ -239,9 +239,9 @@ fn compare_ast_node<'e, 's, 'w>(
|
||||
.get(emacs_key.as_str())
|
||||
.ok_or("Key should exist in both wasm and elisp at this point.")?;
|
||||
layer.extend(compare_json_value(
|
||||
wasm_attribute_value,
|
||||
source,
|
||||
emacs_attribute_value,
|
||||
wasm_attribute_value,
|
||||
)?)?;
|
||||
result.children.push(layer);
|
||||
}
|
||||
@ -408,7 +408,7 @@ where
|
||||
|
||||
let mut child_status = Vec::with_capacity(emacs_length);
|
||||
for (emacs_child, wasm_child) in emacs.zip(wasm) {
|
||||
child_status.push(compare_json_value(wasm_child, source, emacs_child)?);
|
||||
child_status.push(compare_json_value(source, emacs_child, wasm_child)?);
|
||||
}
|
||||
Ok(WasmDiffResult {
|
||||
status: Vec::new(),
|
||||
@ -449,7 +449,7 @@ fn compare_optional_pair<'e, 's, 'w>(
|
||||
let emacs_val = emacs
|
||||
.first()
|
||||
.expect("If-statement proves this will be Some.");
|
||||
result.extend(compare_json_value(wasm_val, source, emacs_val)?)?;
|
||||
result.extend(compare_json_value(source, emacs_val, wasm_val)?)?;
|
||||
} else {
|
||||
// If the optval is not null, then the elisp should have 3 values, the optval, a dot, and the val.
|
||||
if emacs.len() != 3 {
|
||||
@ -472,8 +472,8 @@ fn compare_optional_pair<'e, 's, 'w>(
|
||||
let emacs_val = emacs
|
||||
.get(2)
|
||||
.expect("If-statement proves this will be Some.");
|
||||
result.extend(compare_json_value(wasm_optval, source, emacs_optval)?)?;
|
||||
result.extend(compare_json_value(wasm_val, source, emacs_val)?)?;
|
||||
result.extend(compare_json_value(source, emacs_optval, wasm_optval)?)?;
|
||||
result.extend(compare_json_value(source, emacs_val, wasm_val)?)?;
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user