Fix position of function calls.

This commit is contained in:
Stephen Chung 2022-02-07 16:02:49 +08:00
parent bd9519e96b
commit 556b2393f5
3 changed files with 5 additions and 5 deletions

View File

@ -271,7 +271,7 @@ fn main() {
}
DebuggerEvent::FunctionExitWithValue(r) => {
println!(
"! Return from function call '{}' => {}",
"! Return from function call '{}' => {:?}",
context
.global_runtime_state()
.debugger

View File

@ -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);

View File

@ -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);