Add debugging interface.

This commit is contained in:
Stephen Chung
2022-01-24 17:04:40 +08:00
parent 182870c9ed
commit fc87dec128
24 changed files with 1255 additions and 414 deletions

View File

@@ -44,8 +44,10 @@ impl Engine {
/// Evaluate an [`AST`] with own scope, returning any error (if any).
#[inline]
pub fn run_ast_with_scope(&self, scope: &mut Scope, ast: &AST) -> RhaiResultOf<()> {
let state = &mut EvalState::new();
let global = &mut GlobalRuntimeState::new();
let mut state = EvalState::new();
#[cfg(feature = "debugging")]
global.debugger.activate(self.debugger.is_some());
global.source = ast.source_raw().clone();
#[cfg(not(feature = "no_module"))]
@@ -64,7 +66,7 @@ impl Engine {
} else {
&lib
};
self.eval_global_statements(scope, global, &mut state, statements, lib, 0)?;
self.eval_global_statements(scope, global, state, statements, lib, 0)?;
}
Ok(())
}