Skip to content

Commit 8323fa2

Browse files
committed
refactor(path): Make names more consistent
1 parent 02e62db commit 8323fa2

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/path/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ impl Expression {
7272

7373
Self::Child(expr, key) => {
7474
match expr.get(root) {
75-
Some(value) => {
76-
match value.kind {
75+
Some(child) => {
76+
match child.kind {
7777
// Access on a table is identical to Identifier, it just forwards
7878
ValueKind::Table(ref map) => map.get(&key),
7979

@@ -87,7 +87,7 @@ impl Expression {
8787
}
8888

8989
Self::Subscript(expr, index) => match expr.get(root) {
90-
Some(value) => match value.kind {
90+
Some(child) => match child.kind {
9191
ValueKind::Array(ref array) => {
9292
let index = abs_index(index, array.len()).ok()?;
9393
array.get(index)
@@ -117,12 +117,12 @@ impl Expression {
117117
}
118118

119119
Self::Child(ref expr, ref key) => {
120-
let value = expr.get_mut_forcibly(root);
121-
if !matches!(value.kind, ValueKind::Table(_)) {
122-
*value = Map::<String, Value>::new().into();
120+
let child = expr.get_mut_forcibly(root);
121+
if !matches!(child.kind, ValueKind::Table(_)) {
122+
*child = Map::<String, Value>::new().into();
123123
}
124124

125-
if let ValueKind::Table(ref mut map) = value.kind {
125+
if let ValueKind::Table(ref mut map) = child.kind {
126126
map.entry(key.clone())
127127
.or_insert_with(|| Value::new(None, ValueKind::Nil))
128128
} else {
@@ -131,12 +131,12 @@ impl Expression {
131131
}
132132

133133
Self::Subscript(ref expr, index) => {
134-
let value = expr.get_mut_forcibly(root);
135-
if !matches!(value.kind, ValueKind::Array(_)) {
136-
*value = Vec::<Value>::new().into();
134+
let child = expr.get_mut_forcibly(root);
135+
if !matches!(child.kind, ValueKind::Array(_)) {
136+
*child = Vec::<Value>::new().into();
137137
}
138138

139-
if let ValueKind::Array(ref mut array) = value.kind {
139+
if let ValueKind::Array(ref mut array) = child.kind {
140140
let uindex = match abs_index(index, array.len()) {
141141
Ok(uindex) => {
142142
if uindex >= array.len() {

0 commit comments

Comments
 (0)