Fix builds.

This commit is contained in:
Stephen Chung 2022-02-02 14:57:30 +08:00
parent 339136901d
commit e0ed713bb6
3 changed files with 15 additions and 10 deletions

View File

@ -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"))]

View File

@ -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?

View File

@ -9,7 +9,12 @@ use rhai::Map;
#[test]
fn test_debugging() -> Result<(), Box<EvalAltResult>> {
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"))]