Commit 32319d7b authored by Michael Aaron Murphy's avatar Michael Aaron Murphy

Merge branch 'make-map-reassignment-work' into 'master'

Make map value reassignment actually work

Closes #839

See merge request !890
parents d74cf691 6ffb2a54
......@@ -17,13 +17,12 @@ endif
ifeq (1,$(REDOX))
undefine ARGSV
ARGS += --target x86_64-unknown-redox
PREARGS += +nightly
endif
.PHONY: all clean distclean install uninstall
all: version extract .cargo/config
cargo $(PREARGS) build $(ARGS) $(ARGSV)
cargo build $(ARGS) $(ARGSV)
clean:
cargo clean
......
......@@ -23,3 +23,8 @@ echo @map[key3]
let map:bmap[float] = [ichi=1.0 ni=2.0 san=3.0]
echo @map
let map[ichi] = foo
echo @map
let map[ni] = bar
echo @map
......@@ -12,3 +12,5 @@ one
two
three
ichi 1.0 ni 2.0 san 3.0
ichi foo ni 2.0 san 3.0
ichi foo ni bar san 3.0
......@@ -469,12 +469,10 @@ impl VariableStore for Shell {
Ok(VariableType::Str(ref index)) => {
match self.variables.get_mut(key.name) {
Some(VariableType::HashMap(hmap)) => {
hmap.entry(index.clone())
.or_insert_with(|| VariableType::Str(value));
hmap.insert(index.clone(), VariableType::Str(value));
}
Some(VariableType::BTreeMap(bmap)) => {
bmap.entry(index.clone())
.or_insert_with(|| VariableType::Str(value));
bmap.insert(index.clone(), VariableType::Str(value));
}
Some(VariableType::Array(array)) => {
let index_num = match index.parse::<usize>() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment