From 556b2393f52d3f2e22d3a60c1e770537eef0801e Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Mon, 7 Feb 2022 16:02:49 +0800 Subject: [PATCH] Fix position of function calls. --- src/bin/rhai-dbg.rs | 2 +- src/eval/expr.rs | 4 ++-- src/eval/stmt.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/rhai-dbg.rs b/src/bin/rhai-dbg.rs index 5158eebb..7e62e34c 100644 --- a/src/bin/rhai-dbg.rs +++ b/src/bin/rhai-dbg.rs @@ -271,7 +271,7 @@ fn main() { } DebuggerEvent::FunctionExitWithValue(r) => { println!( - "! Return from function call '{}' => {}", + "! Return from function call '{}' => {:?}", context .global_runtime_state() .debugger diff --git a/src/eval/expr.rs b/src/eval/expr.rs index b7e89972..67bc06b8 100644 --- a/src/eval/expr.rs +++ b/src/eval/expr.rs @@ -270,7 +270,7 @@ impl Engine { // Function calls should account for a relatively larger portion of expressions because // binary operators are also function calls. - if let Expr::FnCall(x, pos) = expr { + if let Expr::FnCall(x, _) = expr { #[cfg(feature = "debugging")] let reset_debugger = self.run_debugger_with_reset(scope, global, state, lib, this_ptr, expr, level)?; @@ -279,7 +279,7 @@ impl Engine { self.inc_operations(&mut global.num_operations, expr.position())?; let result = - self.eval_fn_call_expr(scope, global, state, lib, this_ptr, x, *pos, level); + self.eval_fn_call_expr(scope, global, state, lib, this_ptr, x, x.pos, level); #[cfg(feature = "debugging")] global.debugger.reset_status(reset_debugger); diff --git a/src/eval/stmt.rs b/src/eval/stmt.rs index 1c4a06dc..9c43ea42 100644 --- a/src/eval/stmt.rs +++ b/src/eval/stmt.rs @@ -211,12 +211,12 @@ impl Engine { // Popular branches are lifted out of the `match` statement into their own branches. // Function calls should account for a relatively larger portion of statements. - if let Stmt::FnCall(x, pos) = stmt { + if let Stmt::FnCall(x, _) = stmt { #[cfg(not(feature = "unchecked"))] self.inc_operations(&mut global.num_operations, stmt.position())?; let result = - self.eval_fn_call_expr(scope, global, state, lib, this_ptr, x, *pos, level); + self.eval_fn_call_expr(scope, global, state, lib, this_ptr, x, x.pos, level); #[cfg(feature = "debugging")] global.debugger.reset_status(reset_debugger);