use references when executing instructions, not moves.

This commit is contained in:
Mark Thom
2016-12-01 17:33:02 -07:00
parent d46197f1fd
commit 2874c172ba
3 changed files with 14 additions and 14 deletions

View File

@@ -40,14 +40,14 @@ fn l0_repl<'a>() {
println!("Program stored.");
},
Ok(TopLevel::Query(query)) => {
if let Some(program) = ms.program.clone().take() {
if let Some(program) = ms.program.take() {
let query = compile_query(&query);
for instruction in query {
for instruction in &query {
ms.execute(instruction);
}
for instruction in program {
for instruction in &program {
ms.execute(instruction);
if ms.fail {
@@ -62,6 +62,7 @@ fn l0_repl<'a>() {
}
ms.reset_heap();
ms.program = Some(program);
} else {
println!("No program to speak of.");
}