summaryrefslogtreecommitdiffstats
path: root/src/path/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/path/mod.rs')
-rw-r--r--src/path/mod.rs43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/path/mod.rs b/src/path/mod.rs
index 3916010..ac28400 100644
--- a/src/path/mod.rs
+++ b/src/path/mod.rs
@@ -151,34 +151,30 @@ impl Expression {
_ => None,
},
- Expression::Subscript(ref expr, index) => {
- match expr.get_mut_forcibly(root) {
- Some(value) => {
- match value.kind {
- ValueKind::Array(_) => (),
- _ => *value = Vec::<Value>::new().into(),
- }
-
- match value.kind {
- ValueKind::Array(ref mut array) => {
- let index = sindex_to_uindex(index, array.len());
+ Expression::Subscript(ref expr, index) => match expr.get_mut_forcibly(root) {
+ Some(value) => {
+ match value.kind {
+ ValueKind::Array(_) => (),
+ _ => *value = Vec::<Value>::new().into(),
+ }
- if index >= array.len() {
- array.resize(
- (index + 1) as usize,
- Value::new(None, ValueKind::Nil),
- );
- }
+ match value.kind {
+ ValueKind::Array(ref mut array) => {
+ let index = sindex_to_uindex(index, array.len());
- Some(&mut array[index])
+ if index >= array.len() {
+ array
+ .resize((index + 1) as usize, Value::new(None, ValueKind::Nil));
}
- _ => None,
+ Some(&mut array[index])
}
+
+ _ => None,
}
- _ => None,
}
- }
+ _ => None,
+ },
}
}
@@ -246,10 +242,7 @@ impl Expression {
if let ValueKind::Array(ref mut array) = parent.kind {
let uindex = sindex_to_uindex(index, array.len());
if uindex >= array.len() {
- array.resize(
- (uindex + 1) as usize,
- Value::new(None, ValueKind::Nil),
- );
+ array.resize((uindex + 1) as usize, Value::new(None, ValueKind::Nil));
}
array[uindex] = value;