From 730a7320d686f7460c5a5e5b37ccc0440c2ec9a3 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sun, 20 Dec 2020 23:46:46 +0800 Subject: [PATCH] Run eval with new State. --- src/fn_call.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fn_call.rs b/src/fn_call.rs index 2c06b419..05d20cb4 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -678,8 +678,13 @@ impl Engine { } // Evaluate the AST - let result = self.eval_statements_raw(scope, mods, state, ast.statements(), lib)?; + let mut new_state: State = Default::default(); + new_state.operations = state.operations; + let result = + self.eval_statements_raw(scope, mods, &mut new_state, ast.statements(), lib)?; + + state.operations = new_state.operations; return Ok(result); }