Skip to content

Commit

Permalink
Revert "turn keys to lowercase to enable cross overrides"
Browse files Browse the repository at this point in the history
This reverts commit d2ee90e.
  • Loading branch information
matthiasbeyer authored and MasterPtato committed Jul 10, 2024
1 parent 04e6135 commit 0f3c89b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl Expression {
match *self {
Self::Identifier(ref id) => match root.kind {
ValueKind::Table(ref mut map) => Some(
map.entry(id.to_lowercase())
map.entry(id.clone())
.or_insert_with(|| Value::new(None, ValueKind::Nil)),
),

Expand All @@ -131,15 +131,15 @@ impl Expression {
Some(value) => {
if let ValueKind::Table(ref mut map) = value.kind {
Some(
map.entry(key.to_lowercase())
map.entry(key.clone())
.or_insert_with(|| Value::new(None, ValueKind::Nil)),
)
} else {
*value = Map::<String, Value>::new().into();

if let ValueKind::Table(ref mut map) = value.kind {
Some(
map.entry(key.to_lowercase())
map.entry(key.clone())
.or_insert_with(|| Value::new(None, ValueKind::Nil)),
)
} else {
Expand Down Expand Up @@ -193,25 +193,25 @@ impl Expression {
ValueKind::Table(ref incoming_map) => {
// Pull out another table
let target = if let ValueKind::Table(ref mut map) = root.kind {
map.entry(id.to_lowercase())
map.entry(id.clone())
.or_insert_with(|| Map::<String, Value>::new().into())
} else {
unreachable!();
};

// Continue the deep merge
for (key, val) in incoming_map {
Self::Identifier(key.to_lowercase()).set(target, val.clone());
Self::Identifier(key.clone()).set(target, val.clone());
}
}

_ => {
if let ValueKind::Table(ref mut map) = root.kind {
// Just do a simple set
if let Some(existing) = map.get_mut(&id.to_lowercase()) {
if let Some(existing) = map.get_mut(id) {
*existing = value;
} else {
map.insert(id.to_lowercase(), value);
map.insert(id.clone(), value);
}
}
}
Expand All @@ -224,7 +224,7 @@ impl Expression {
// Didn't find a table. Oh well. Make a table and do this anyway
*parent = Map::<String, Value>::new().into();
}
Self::Identifier(key.to_lowercase()).set(parent, value);
Self::Identifier(key.clone()).set(parent, value);
}
}

Expand Down

0 comments on commit 0f3c89b

Please sign in to comment.