Simplify debugger calls.

This commit is contained in:
Stephen Chung
2022-02-03 11:56:08 +08:00
parent 8322e62c18
commit 9fa6839380
6 changed files with 90 additions and 111 deletions

View File

@@ -266,11 +266,8 @@ impl Engine {
// binary operators are also function calls.
if let Expr::FnCall(x, pos) = expr {
#[cfg(feature = "debugging")]
let reset_debugger = if self.debugger.is_some() {
self.run_debugger_with_reset(scope, global, state, lib, this_ptr, expr, level)?
} else {
None
};
let reset_debugger =
self.run_debugger_with_reset(scope, global, state, lib, this_ptr, expr, level)?;
#[cfg(not(feature = "unchecked"))]
self.inc_operations(&mut global.num_operations, expr.position())?;
@@ -289,9 +286,7 @@ impl Engine {
// will cost more than the mis-predicted `match` branch.
if let Expr::Variable(index, var_pos, x) = expr {
#[cfg(feature = "debugging")]
if self.debugger.is_some() {
self.run_debugger(scope, global, state, lib, this_ptr, expr, level)?;
}
self.run_debugger(scope, global, state, lib, this_ptr, expr, level)?;
#[cfg(not(feature = "unchecked"))]
self.inc_operations(&mut global.num_operations, expr.position())?;
@@ -308,11 +303,8 @@ impl Engine {
}
#[cfg(feature = "debugging")]
let reset_debugger = if self.debugger.is_some() {
self.run_debugger_with_reset(scope, global, state, lib, this_ptr, expr, level)?
} else {
None
};
let reset_debugger =
self.run_debugger_with_reset(scope, global, state, lib, this_ptr, expr, level)?;
#[cfg(not(feature = "unchecked"))]
self.inc_operations(&mut global.num_operations, expr.position())?;