Move level into GlobalRuntimeState.

This commit is contained in:
Stephen Chung
2022-11-08 21:28:20 +08:00
parent 5bae4d8a19
commit e93923b3b6
21 changed files with 409 additions and 493 deletions

View File

@@ -326,7 +326,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
name: &str,
op_token: Option<&Token>,
hash: u64,
@@ -385,7 +384,7 @@ impl Engine {
// Run external function
let src = source.as_ref().map(|s| s.as_str());
let context = (self, name, src, &*global, lib, pos, level).into();
let context = (self, name, src, &*global, lib, pos).into();
let mut _result = if func.is_plugin_fn() {
let f = func.get_plugin_fn().unwrap();
@@ -401,7 +400,7 @@ impl Engine {
#[cfg(feature = "debugging")]
{
let trigger = match global.debugger.status {
crate::eval::DebuggerStatus::FunctionExit(n) => n >= level,
crate::eval::DebuggerStatus::FunctionExit(n) => n >= global.level,
crate::eval::DebuggerStatus::Next(.., true) => true,
_ => false,
};
@@ -415,8 +414,8 @@ impl Engine {
Err(ref err) => crate::eval::DebuggerEvent::FunctionExitWithError(err),
};
if let Err(err) = self
.run_debugger_raw(global, caches, lib, level, scope, &mut this, node, event)
if let Err(err) =
self.run_debugger_raw(global, caches, lib, scope, &mut this, node, event)
{
_result = Err(err);
}
@@ -539,7 +538,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
_scope: Option<&mut Scope>,
fn_name: &str,
op_token: Option<&Token>,
@@ -561,7 +559,8 @@ impl Engine {
#[cfg(not(feature = "no_closure"))]
ensure_no_data_race(fn_name, args, is_ref_mut)?;
let level = level + 1;
global.level += 1;
let global = &mut *RestoreOnDrop::lock(global, move |g| g.level -= 1);
// These may be redirected from method style calls.
if hashes.is_native_only() {
@@ -647,7 +646,7 @@ impl Engine {
let (first_arg, rest_args) = args.split_first_mut().unwrap();
self.call_script_fn(
global, caches, lib, level, scope, first_arg, func, rest_args, true, pos,
global, caches, lib, scope, first_arg, func, rest_args, true, pos,
)
} else {
// Normal call of script function
@@ -667,7 +666,7 @@ impl Engine {
let mut this = Dynamic::NULL;
self.call_script_fn(
global, caches, lib, level, scope, &mut this, func, args, true, pos,
global, caches, lib, scope, &mut this, func, args, true, pos,
)
}
.map(|r| (r, false));
@@ -678,7 +677,7 @@ impl Engine {
let hash = hashes.native();
self.exec_native_fn_call(
global, caches, lib, level, fn_name, op_token, hash, args, is_ref_mut, pos,
global, caches, lib, fn_name, op_token, hash, args, is_ref_mut, pos,
)
}
@@ -689,7 +688,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
scope: &mut Scope,
this_ptr: &mut Dynamic,
arg_expr: &Expr,
@@ -699,7 +697,7 @@ impl Engine {
self.track_operation(global, arg_expr.start_position())?;
#[cfg(feature = "debugging")]
self.run_debugger(global, caches, lib, level, scope, this_ptr, arg_expr)?;
self.run_debugger(global, caches, lib, scope, this_ptr, arg_expr)?;
return Ok((value, arg_expr.start_position()));
}
@@ -712,7 +710,7 @@ impl Engine {
#[cfg(feature = "debugging")]
let global = &mut *RestoreOnDrop::lock(global, move |g| g.debugger.reset_status(reset));
self.eval_expr(global, caches, lib, level, scope, this_ptr, arg_expr)
self.eval_expr(global, caches, lib, scope, this_ptr, arg_expr)
.map(|r| (r, arg_expr.start_position()))
}
@@ -723,7 +721,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
fn_name: &str,
mut hash: FnCallHashes,
target: &mut crate::eval::Target,
@@ -764,7 +761,6 @@ impl Engine {
global,
caches,
lib,
level,
None,
fn_name,
None,
@@ -820,7 +816,6 @@ impl Engine {
global,
caches,
lib,
level,
None,
&fn_name,
None,
@@ -921,7 +916,6 @@ impl Engine {
global,
caches,
lib,
level,
None,
fn_name,
None,
@@ -948,7 +942,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
scope: &mut Scope,
this_ptr: &mut Dynamic,
fn_name: &str,
@@ -974,7 +967,7 @@ impl Engine {
KEYWORD_FN_PTR_CALL if total_args >= 1 => {
let arg = first_arg.unwrap();
let (arg_value, arg_pos) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, arg)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, arg)?;
if !arg_value.is::<FnPtr>() {
let typ = self.map_type_name(arg_value.type_name());
@@ -1015,7 +1008,7 @@ impl Engine {
KEYWORD_FN_PTR if total_args == 1 => {
let arg = first_arg.unwrap();
let (arg_value, arg_pos) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, arg)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, arg)?;
// Fn - only in function call style
return arg_value
@@ -1030,7 +1023,7 @@ impl Engine {
KEYWORD_FN_PTR_CURRY if total_args > 1 => {
let first = first_arg.unwrap();
let (arg_value, arg_pos) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, first)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, first)?;
if !arg_value.is::<FnPtr>() {
let typ = self.map_type_name(arg_value.type_name());
@@ -1042,7 +1035,7 @@ impl Engine {
// Append the new curried arguments to the existing list.
let fn_curry = a_expr.iter().try_fold(fn_curry, |mut curried, expr| {
let (value, ..) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, expr)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, expr)?;
curried.push(value);
Ok::<_, RhaiError>(curried)
})?;
@@ -1055,7 +1048,7 @@ impl Engine {
crate::engine::KEYWORD_IS_SHARED if total_args == 1 => {
let arg = first_arg.unwrap();
let (arg_value, ..) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, arg)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, arg)?;
return Ok(arg_value.is_shared().into());
}
@@ -1064,14 +1057,14 @@ impl Engine {
crate::engine::KEYWORD_IS_DEF_FN if total_args == 2 => {
let first = first_arg.unwrap();
let (arg_value, arg_pos) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, first)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, first)?;
let fn_name = arg_value
.into_immutable_string()
.map_err(|typ| self.make_type_mismatch_err::<ImmutableString>(typ, arg_pos))?;
let (arg_value, arg_pos) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, &a_expr[0])?;
self.get_arg_value(global, caches, lib, scope, this_ptr, &a_expr[0])?;
let num_params = arg_value
.as_int()
@@ -1090,7 +1083,7 @@ impl Engine {
KEYWORD_IS_DEF_VAR if total_args == 1 => {
let arg = first_arg.unwrap();
let (arg_value, arg_pos) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, arg)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, arg)?;
let var_name = arg_value
.into_immutable_string()
.map_err(|typ| self.make_type_mismatch_err::<ImmutableString>(typ, arg_pos))?;
@@ -1105,12 +1098,15 @@ impl Engine {
let orig_imports_len = global.num_imports();
let arg = first_arg.unwrap();
let (arg_value, pos) =
self.get_arg_value(global, caches, lib, level, scope, this_ptr, arg)?;
self.get_arg_value(global, caches, lib, scope, this_ptr, arg)?;
let s = &arg_value
.into_immutable_string()
.map_err(|typ| self.make_type_mismatch_err::<ImmutableString>(typ, pos))?;
let result =
self.eval_script_expr_in_place(global, caches, lib, level + 1, scope, s, pos);
global.level += 1;
let global = &mut *RestoreOnDrop::lock(global, move |g| g.level -= 1);
let result = self.eval_script_expr_in_place(global, caches, lib, scope, s, pos);
// IMPORTANT! If the eval defines new variables in the current scope,
// all variable offsets from this point on will be mis-aligned.
@@ -1152,7 +1148,7 @@ impl Engine {
.copied()
.chain(a_expr.iter())
.try_for_each(|expr| {
self.get_arg_value(global, caches, lib, level, scope, this_ptr, expr)
self.get_arg_value(global, caches, lib, scope, this_ptr, expr)
.map(|(value, ..)| arg_values.push(value.flatten()))
})?;
args.extend(curry.iter_mut());
@@ -1163,8 +1159,8 @@ impl Engine {
return self
.exec_fn_call(
global, caches, lib, level, scope, name, op_token, hashes, &mut args,
is_ref_mut, false, pos,
global, caches, lib, scope, name, op_token, hashes, &mut args, is_ref_mut,
false, pos,
)
.map(|(v, ..)| v);
}
@@ -1180,16 +1176,16 @@ impl Engine {
let first_expr = first_arg.unwrap();
#[cfg(feature = "debugging")]
self.run_debugger(global, caches, lib, level, scope, this_ptr, first_expr)?;
self.run_debugger(global, caches, lib, scope, this_ptr, first_expr)?;
// func(x, ...) -> x.func(...)
a_expr.iter().try_for_each(|expr| {
self.get_arg_value(global, caches, lib, level, scope, this_ptr, expr)
self.get_arg_value(global, caches, lib, scope, this_ptr, expr)
.map(|(value, ..)| arg_values.push(value.flatten()))
})?;
let (mut target, _pos) =
self.search_namespace(global, caches, lib, level, scope, this_ptr, first_expr)?;
self.search_namespace(global, caches, lib, scope, this_ptr, first_expr)?;
if target.is_read_only() {
target = target.into_owned();
@@ -1216,7 +1212,7 @@ impl Engine {
.into_iter()
.chain(a_expr.iter())
.try_for_each(|expr| {
self.get_arg_value(global, caches, lib, level, scope, this_ptr, expr)
self.get_arg_value(global, caches, lib, scope, this_ptr, expr)
.map(|(value, ..)| arg_values.push(value.flatten()))
})?;
args.extend(curry.iter_mut());
@@ -1226,8 +1222,7 @@ impl Engine {
}
self.exec_fn_call(
global, caches, lib, level, None, name, op_token, hashes, &mut args, is_ref_mut, false,
pos,
global, caches, lib, None, name, op_token, hashes, &mut args, is_ref_mut, false, pos,
)
.map(|(v, ..)| v)
}
@@ -1239,7 +1234,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
scope: &mut Scope,
this_ptr: &mut Dynamic,
namespace: &crate::ast::Namespace,
@@ -1260,20 +1254,20 @@ impl Engine {
// and avoid cloning the value
if !args_expr.is_empty() && args_expr[0].is_variable_access(true) {
#[cfg(feature = "debugging")]
self.run_debugger(global, caches, lib, level, scope, this_ptr, &args_expr[0])?;
self.run_debugger(global, caches, lib, scope, this_ptr, &args_expr[0])?;
// func(x, ...) -> x.func(...)
arg_values.push(Dynamic::UNIT);
args_expr.iter().skip(1).try_for_each(|expr| {
self.get_arg_value(global, caches, lib, level, scope, this_ptr, expr)
self.get_arg_value(global, caches, lib, scope, this_ptr, expr)
.map(|(value, ..)| arg_values.push(value.flatten()))
})?;
// Get target reference to first argument
let first_arg = &args_expr[0];
let (target, _pos) =
self.search_scope_only(global, caches, lib, level, scope, this_ptr, first_arg)?;
self.search_scope_only(global, caches, lib, scope, this_ptr, first_arg)?;
self.track_operation(global, _pos)?;
@@ -1296,7 +1290,7 @@ impl Engine {
} else {
// func(..., ...) or func(mod::x, ...)
args_expr.iter().try_for_each(|expr| {
self.get_arg_value(global, caches, lib, level, scope, this_ptr, expr)
self.get_arg_value(global, caches, lib, scope, this_ptr, expr)
.map(|(value, ..)| arg_values.push(value.flatten()))
})?;
args.extend(arg_values.iter_mut());
@@ -1363,7 +1357,8 @@ impl Engine {
}
}
let level = level + 1;
global.level += 1;
let global = &mut *RestoreOnDrop::lock(global, move |g| g.level -= 1);
match func {
#[cfg(not(feature = "no_function"))]
@@ -1376,12 +1371,12 @@ impl Engine {
let global = &mut *RestoreOnDrop::lock(global, move |g| g.source = orig_source);
self.call_script_fn(
global, caches, lib, level, new_scope, &mut this, fn_def, &mut args, true, pos,
global, caches, lib, new_scope, &mut this, fn_def, &mut args, true, pos,
)
}
Some(f) if f.is_plugin_fn() => {
let context = (self, fn_name, module.id(), &*global, lib, pos, level).into();
let context = (self, fn_name, module.id(), &*global, lib, pos).into();
let f = f.get_plugin_fn().expect("plugin function");
let result = if !f.is_pure() && !args.is_empty() && args[0].is_read_only() {
Err(ERR::ErrorNonPureMethodCallOnConstant(fn_name.to_string(), pos).into())
@@ -1393,7 +1388,7 @@ impl Engine {
Some(f) if f.is_native() => {
let func = f.get_native_fn().expect("native function");
let context = (self, fn_name, module.id(), &*global, lib, pos, level).into();
let context = (self, fn_name, module.id(), &*global, lib, pos).into();
let result = func(context, &mut args);
self.check_return_value(result, pos)
}
@@ -1422,7 +1417,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
scope: &mut Scope,
script: &str,
_pos: Position,
@@ -1458,7 +1452,7 @@ impl Engine {
}
// Evaluate the AST
self.eval_global_statements(global, caches, lib, level, scope, statements)
self.eval_global_statements(global, caches, lib, scope, statements)
}
/// Evaluate a function call expression.
@@ -1467,7 +1461,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
scope: &mut Scope,
this_ptr: &mut Dynamic,
expr: &FnCallExpr,
@@ -1489,12 +1482,12 @@ impl Engine {
// Short-circuit native binary operator call if under Fast Operators mode
if op_token.is_some() && self.fast_operators() && args.len() == 2 {
let mut lhs = self
.get_arg_value(global, caches, lib, level, scope, this_ptr, &args[0])?
.get_arg_value(global, caches, lib, scope, this_ptr, &args[0])?
.0
.flatten();
let mut rhs = self
.get_arg_value(global, caches, lib, level, scope, this_ptr, &args[1])?
.get_arg_value(global, caches, lib, scope, this_ptr, &args[1])?
.0
.flatten();
@@ -1504,14 +1497,16 @@ impl Engine {
get_builtin_binary_op_fn(op_token.as_ref().unwrap(), operands[0], operands[1])
{
// Built-in found
let context = (self, name.as_str(), None, &*global, lib, pos, level + 1).into();
global.level += 1;
let global = &*RestoreOnDrop::lock(global, move |g| g.level -= 1);
let context = (self, name.as_str(), None, global, lib, pos).into();
return func(context, operands);
}
return self
.exec_fn_call(
global, caches, lib, level, None, name, op_token, *hashes, operands, false,
false, pos,
global, caches, lib, None, name, op_token, *hashes, operands, false, false, pos,
)
.map(|(v, ..)| v);
}
@@ -1522,7 +1517,7 @@ impl Engine {
let hash = hashes.native();
return self.make_qualified_function_call(
global, caches, lib, level, scope, this_ptr, namespace, name, args, hash, pos,
global, caches, lib, scope, this_ptr, namespace, name, args, hash, pos,
);
}
@@ -1533,7 +1528,7 @@ impl Engine {
);
self.make_function_call(
global, caches, lib, level, scope, this_ptr, name, op_token, first_arg, args, *hashes,
global, caches, lib, scope, this_ptr, name, op_token, first_arg, args, *hashes,
*capture, pos,
)
}

View File

@@ -72,13 +72,11 @@ pub struct NativeCallContext<'a> {
/// Function source, if any.
source: Option<&'a str>,
/// The current [`GlobalRuntimeState`], if any.
global: Option<&'a GlobalRuntimeState>,
global: &'a GlobalRuntimeState,
/// The current stack of loaded [modules][Module].
lib: &'a [SharedModule],
/// [Position] of the function call.
pos: Position,
/// The current nesting level of function calls.
level: usize,
}
/// _(internals)_ Context of a native Rust function call.
@@ -96,8 +94,6 @@ pub struct NativeCallContextStore {
pub lib: StaticVec<SharedModule>,
/// [Position] of the function call.
pub pos: Position,
/// The current nesting level of function calls.
pub level: usize,
}
#[cfg(feature = "internals")]
@@ -118,7 +114,6 @@ impl<'a>
&'a GlobalRuntimeState,
&'a [SharedModule],
Position,
usize,
)> for NativeCallContext<'a>
{
#[inline(always)]
@@ -130,56 +125,20 @@ impl<'a>
&'a GlobalRuntimeState,
&'a [SharedModule],
Position,
usize,
),
) -> Self {
Self {
engine: value.0,
fn_name: value.1,
source: value.2,
global: Some(value.3),
global: value.3,
lib: value.4,
pos: value.5,
level: value.6,
}
}
}
impl<'a> From<(&'a Engine, &'a str, &'a [SharedModule])> for NativeCallContext<'a> {
#[inline(always)]
fn from(value: (&'a Engine, &'a str, &'a [SharedModule])) -> Self {
Self {
engine: value.0,
fn_name: value.1,
source: None,
global: None,
lib: value.2,
pos: Position::NONE,
level: 0,
}
}
}
impl<'a> NativeCallContext<'a> {
/// _(internals)_ Create a new [`NativeCallContext`].
/// Exported under the `internals` feature only.
#[deprecated(
since = "1.3.0",
note = "`NativeCallContext::new` will be moved under `internals`. Use `FnPtr::call` to call a function pointer directly."
)]
#[inline(always)]
#[must_use]
pub fn new(engine: &'a Engine, fn_name: &'a str, lib: &'a [SharedModule]) -> Self {
Self {
engine,
fn_name,
source: None,
global: None,
lib,
pos: Position::NONE,
level: 0,
}
}
/// _(internals)_ Create a new [`NativeCallContext`].
/// Exported under the `internals` feature only.
///
@@ -195,16 +154,14 @@ impl<'a> NativeCallContext<'a> {
global: &'a GlobalRuntimeState,
lib: &'a [SharedModule],
pos: Position,
level: usize,
) -> Self {
Self {
engine,
fn_name,
source,
global: Some(global),
global,
lib,
pos,
level,
}
}
@@ -218,10 +175,9 @@ impl<'a> NativeCallContext<'a> {
engine,
fn_name: &context.fn_name,
source: context.source.as_ref().map(String::as_str),
global: Some(&context.global),
global: &context.global,
lib: &context.lib,
pos: context.pos,
level: context.level,
}
}
/// _(internals)_ Store this [`NativeCallContext`] into a [`NativeCallContextClone`].
@@ -233,10 +189,9 @@ impl<'a> NativeCallContext<'a> {
NativeCallContextStore {
fn_name: self.fn_name.to_string(),
source: self.source.map(|s| s.to_string()),
global: self.global.unwrap().clone(),
global: self.global.clone(),
lib: self.lib.iter().cloned().collect(),
pos: self.pos,
level: self.level,
}
}
@@ -262,7 +217,7 @@ impl<'a> NativeCallContext<'a> {
#[inline(always)]
#[must_use]
pub const fn call_level(&self) -> usize {
self.level
self.global.level
}
/// The current source.
#[inline(always)]
@@ -274,7 +229,7 @@ impl<'a> NativeCallContext<'a> {
#[inline(always)]
#[must_use]
pub fn tag(&self) -> Option<&Dynamic> {
self.global.as_ref().map(|g| &g.tag)
Some(&self.global.tag)
}
/// Get an iterator over the current set of modules imported via `import` statements
/// in reverse order.
@@ -283,7 +238,7 @@ impl<'a> NativeCallContext<'a> {
#[cfg(not(feature = "no_module"))]
#[inline]
pub fn iter_imports(&self) -> impl Iterator<Item = (&str, &Module)> {
self.global.iter().flat_map(|&g| g.iter_imports())
self.global.iter_imports()
}
/// Get an iterator over the current set of modules imported via `import` statements in reverse order.
#[cfg(not(feature = "no_module"))]
@@ -292,7 +247,7 @@ impl<'a> NativeCallContext<'a> {
pub(crate) fn iter_imports_raw(
&self,
) -> impl Iterator<Item = (&crate::ImmutableString, &SharedModule)> {
self.global.iter().flat_map(|&g| g.iter_imports_raw())
self.global.iter_imports_raw()
}
/// _(internals)_ The current [`GlobalRuntimeState`], if any.
/// Exported under the `internals` feature only.
@@ -301,7 +256,7 @@ impl<'a> NativeCallContext<'a> {
#[cfg(feature = "internals")]
#[inline(always)]
#[must_use]
pub const fn global_runtime_state(&self) -> Option<&GlobalRuntimeState> {
pub const fn global_runtime_state(&self) -> &GlobalRuntimeState {
self.global
}
/// Get an iterator over the namespaces containing definitions of all script-defined functions
@@ -437,10 +392,7 @@ impl<'a> NativeCallContext<'a> {
is_method_call: bool,
args: &mut [&mut Dynamic],
) -> RhaiResult {
let global = &mut self
.global
.cloned()
.unwrap_or_else(|| GlobalRuntimeState::new(self.engine()));
let mut global = &mut self.global.clone();
let caches = &mut Caches::new();
let fn_name = fn_name.as_ref();
@@ -448,6 +400,8 @@ impl<'a> NativeCallContext<'a> {
let op_token = op_token.as_ref();
let args_len = args.len();
global.level += 1;
if native_only {
return self
.engine()
@@ -455,7 +409,6 @@ impl<'a> NativeCallContext<'a> {
global,
caches,
self.lib,
self.level + 1,
fn_name,
op_token,
calc_fn_hash(None, fn_name, args_len),
@@ -483,7 +436,6 @@ impl<'a> NativeCallContext<'a> {
global,
caches,
self.lib,
self.level + 1,
None,
fn_name,
op_token,

View File

@@ -27,7 +27,6 @@ impl Engine {
global: &mut GlobalRuntimeState,
caches: &mut Caches,
lib: &[SharedModule],
level: usize,
scope: &mut Scope,
this_ptr: &mut Dynamic,
fn_def: &ScriptFnDef,
@@ -66,7 +65,7 @@ impl Engine {
self.track_operation(global, pos)?;
// Check for stack overflow
if level > self.max_call_levels() {
if global.level > self.max_call_levels() {
return Err(ERR::ErrorStackOverflow(pos).into());
}
@@ -140,7 +139,7 @@ impl Engine {
#[cfg(feature = "debugging")]
{
let node = crate::ast::Stmt::Noop(fn_def.body.position());
self.run_debugger(global, caches, lib, level, scope, this_ptr, &node)?;
self.run_debugger(global, caches, lib, scope, this_ptr, &node)?;
}
// Evaluate the function
@@ -149,7 +148,6 @@ impl Engine {
global,
caches,
lib,
level,
scope,
this_ptr,
&fn_def.body,
@@ -179,7 +177,7 @@ impl Engine {
#[cfg(feature = "debugging")]
{
let trigger = match global.debugger.status {
crate::eval::DebuggerStatus::FunctionExit(n) => n >= level,
crate::eval::DebuggerStatus::FunctionExit(n) => n >= global.level,
crate::eval::DebuggerStatus::Next(.., true) => true,
_ => false,
};
@@ -190,9 +188,7 @@ impl Engine {
Ok(ref r) => crate::eval::DebuggerEvent::FunctionExitWithValue(r),
Err(ref err) => crate::eval::DebuggerEvent::FunctionExitWithError(err),
};
match self
.run_debugger_raw(global, caches, lib, level, scope, this_ptr, node, event)
{
match self.run_debugger_raw(global, caches, lib, scope, this_ptr, node, event) {
Ok(_) => (),
Err(err) => _result = Err(err),
}