diff --git a/src/func/call.rs b/src/func/call.rs index a73bd7bb..cd0d9614 100644 --- a/src/func/call.rs +++ b/src/func/call.rs @@ -375,7 +375,7 @@ impl Engine { #[cfg(feature = "debugging")] let orig_call_stack_len = global.debugger.call_stack().len(); - let mut result = if let Some(FnResolutionCacheEntry { func, source }) = func { + let mut _result = if let Some(FnResolutionCacheEntry { func, source }) = func { assert!(func.is_native()); // Calling pure function but the first argument is a reference? @@ -432,14 +432,14 @@ impl Engine { let scope = &mut &mut Scope::new(); let node = crate::ast::Stmt::Noop(pos); let node = (&node).into(); - let event = match result { + let event = match _result { Ok(ref r) => crate::eval::DebuggerEvent::FunctionExitWithValue(r), Err(ref err) => crate::eval::DebuggerEvent::FunctionExitWithError(err), }; if let Err(err) = self.run_debugger_raw( scope, global, state, lib, &mut None, node, event, level, ) { - result = Err(err); + _result = Err(err); } } _ => (), @@ -450,7 +450,7 @@ impl Engine { } // Check the return value (including data sizes) - let result = self.check_return_value(result, pos)?; + let result = self.check_return_value(_result, pos)?; // Check the data size of any `&mut` object, which may be changed. #[cfg(not(feature = "unchecked"))] diff --git a/src/func/script.rs b/src/func/script.rs index 5178ed2b..9c10e76e 100644 --- a/src/func/script.rs +++ b/src/func/script.rs @@ -137,7 +137,7 @@ impl Engine { }; // Evaluate the function - let mut result = self + let mut _result = self .eval_stmt_block( scope, global, @@ -176,19 +176,19 @@ impl Engine { crate::eval::DebuggerStatus::FunctionExit(n) if n >= level => { let node = crate::ast::Stmt::Noop(pos); let node = (&node).into(); - let event = match result { + let event = match _result { Ok(ref r) => crate::eval::DebuggerEvent::FunctionExitWithValue(r), Err(ref err) => crate::eval::DebuggerEvent::FunctionExitWithError(err), }; if let Err(err) = self .run_debugger_raw(scope, global, state, lib, this_ptr, node, event, level) { - result = Err(err); + _result = Err(err); } } _ => (), } - + // Pop the call stack global.debugger.rewind_call_stack(orig_call_stack_len); } @@ -212,7 +212,7 @@ impl Engine { // Restore state state.rewind_fn_resolution_caches(orig_fn_resolution_caches_len); - result + _result } // Does a script-defined function exist? diff --git a/tests/debugging.rs b/tests/debugging.rs index b40c1016..aa797624 100644 --- a/tests/debugging.rs +++ b/tests/debugging.rs @@ -9,7 +9,12 @@ use rhai::Map; #[test] fn test_debugging() -> Result<(), Box> { - let engine = Engine::new(); + let mut engine = Engine::new(); + + engine.register_debugger( + || Dynamic::UNIT, + |_, _, _, _, _| Ok(rhai::debugger::DebuggerCommand::Continue), + ); #[cfg(not(feature = "no_function"))] #[cfg(not(feature = "no_index"))]