Handle nil in object tree.
This commit is contained in:
parent
ff3e0a50af
commit
dc0338e978
@ -566,7 +566,6 @@ fn compare_object_tree<'e, 's, 'w>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (emacs_attribute, wasm_attribute) in emacs.iter().zip(wasm_attributes.iter()) {
|
for (emacs_attribute, wasm_attribute) in emacs.iter().zip(wasm_attributes.iter()) {
|
||||||
let emacs_attribute = emacs_attribute.as_list()?;
|
|
||||||
let wasm_attribute = wasm_attribute
|
let wasm_attribute = wasm_attribute
|
||||||
.as_array()
|
.as_array()
|
||||||
.ok_or("Wasm middle layer in object tree should be a list.")?;
|
.ok_or("Wasm middle layer in object tree should be a list.")?;
|
||||||
@ -580,6 +579,16 @@ fn compare_object_tree<'e, 's, 'w>(
|
|||||||
));
|
));
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
if let Ok("nil") = emacs_attribute.as_atom() {
|
||||||
|
if let Some(serde_json::Value::Null) = wasm_attribute.first() {
|
||||||
|
if let Some(serde_json::Value::Array(w)) = wasm_attribute.get(1) {
|
||||||
|
if w.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let emacs_attribute = emacs_attribute.as_list()?;
|
||||||
if let Some(serde_json::Value::Null) = wasm_attribute.first() {
|
if let Some(serde_json::Value::Null) = wasm_attribute.first() {
|
||||||
// If optval is null then the emacs array should only contain 1 value.
|
// If optval is null then the emacs array should only contain 1 value.
|
||||||
if emacs_attribute.len() != 1 {
|
if emacs_attribute.len() != 1 {
|
||||||
@ -622,19 +631,26 @@ fn compare_object_tree<'e, 's, 'w>(
|
|||||||
.ok_or("first value in wasm object tree should be a list.")?;
|
.ok_or("first value in wasm object tree should be a list.")?;
|
||||||
let emacs_val = emacs_attribute
|
let emacs_val = emacs_attribute
|
||||||
.first()
|
.first()
|
||||||
.ok_or("If-statement proves this will be Some.")?
|
.ok_or("If-statement proves this will be Some.")?;
|
||||||
.as_list()?;
|
|
||||||
let wasm_val = wasm_attribute
|
let wasm_val = wasm_attribute
|
||||||
.get(1)
|
.get(1)
|
||||||
.expect("If-statement proves this will be Some.")
|
.expect("If-statement proves this will be Some.")
|
||||||
.as_array()
|
.as_array()
|
||||||
.ok_or("2nd value in wasm object tree should be a list.")?;
|
.ok_or("2nd value in wasm object tree should be a list.")?;
|
||||||
result.extend(wasm_compare_list(source, emacs_optval, wasm_optval.iter())?)?;
|
result.extend(wasm_compare_list(source, emacs_optval, wasm_optval.iter())?)?;
|
||||||
result.extend(wasm_compare_list(
|
if let Ok("nil") = emacs_val.as_atom() {
|
||||||
source,
|
result.extend(wasm_compare_list(
|
||||||
emacs_val.iter(),
|
source,
|
||||||
wasm_val.iter(),
|
std::iter::empty(),
|
||||||
)?)?;
|
wasm_val.iter(),
|
||||||
|
)?)?;
|
||||||
|
} else {
|
||||||
|
result.extend(wasm_compare_list(
|
||||||
|
source,
|
||||||
|
emacs_val.as_list()?.iter(),
|
||||||
|
wasm_val.iter(),
|
||||||
|
)?)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user