Move level into GlobalRuntimeState.
This commit is contained in:
@@ -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),
|
||||
}
|
||||
|
Reference in New Issue
Block a user