add variable updates and some fixing
This commit is contained in:
parent
581c301165
commit
8403628d7f
2 changed files with 9 additions and 3 deletions
|
@ -131,10 +131,10 @@ impl Executor {
|
|||
let red = self.read_memory(key.clone(), true);
|
||||
match red {
|
||||
ASTPart::NOOP => {
|
||||
self.delete_memory(key.clone());
|
||||
panic!("Uanble to update non-existing memory key: {}", key);
|
||||
},
|
||||
_ => {
|
||||
panic!("Uanble to update non-existing memory key: {}", key);
|
||||
self.delete_memory(key.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,6 +254,11 @@ impl Executor {
|
|||
let data = self.read_memory(var.variable.clone(), false);
|
||||
return data;
|
||||
},
|
||||
ASTPart::VarUpdate(updt) => {
|
||||
let value = self.process_code(&updt.value, op_count);
|
||||
self.write_memory(updt.variable.clone(), value, true);
|
||||
return ASTPart::NOOP;
|
||||
},
|
||||
_ => {
|
||||
return ASTPart::NOOP;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue