Add parameter to debugger init.
This commit is contained in:
parent
a51f6138f6
commit
8c20801574
@ -15,6 +15,11 @@ Bug fixes
|
||||
* Fixes panic in interpolated strings with constant expressions.
|
||||
* Using `call_fn_raw` on a function without evaluating the AST no longer panics on namespace-qualified function calls due to `import` statements not run.
|
||||
|
||||
Breaking changes
|
||||
----------------
|
||||
|
||||
* The first closure passed to `Engine::register_debugger` now takes a single parameter which is a reference to the current `Engine`.
|
||||
|
||||
New features
|
||||
------------
|
||||
|
||||
|
@ -348,7 +348,7 @@ impl Engine {
|
||||
#[inline(always)]
|
||||
pub fn register_debugger(
|
||||
&mut self,
|
||||
init: impl Fn() -> Dynamic + SendSync + 'static,
|
||||
init: impl Fn(&Engine) -> Dynamic + SendSync + 'static,
|
||||
callback: impl Fn(
|
||||
EvalContext,
|
||||
crate::eval::DebuggerEvent,
|
||||
|
@ -611,7 +611,7 @@ fn main() {
|
||||
#[allow(deprecated)]
|
||||
engine.register_debugger(
|
||||
// Store the current source in the debugger state
|
||||
|| "".into(),
|
||||
|_| "".into(),
|
||||
// Main debugging interface
|
||||
move |context, event, node, source, pos| {
|
||||
debug_callback(context, event, node, source, pos, &lines)
|
||||
|
@ -10,10 +10,10 @@ use std::{fmt, iter::repeat, mem};
|
||||
|
||||
/// Callback function to initialize the debugger.
|
||||
#[cfg(not(feature = "sync"))]
|
||||
pub type OnDebuggingInit = dyn Fn() -> Dynamic;
|
||||
pub type OnDebuggingInit = dyn Fn(&Engine) -> Dynamic;
|
||||
/// Callback function to initialize the debugger.
|
||||
#[cfg(feature = "sync")]
|
||||
pub type OnDebuggingInit = dyn Fn() -> Dynamic + Send + Sync;
|
||||
pub type OnDebuggingInit = dyn Fn(&Engine) -> Dynamic + Send + Sync;
|
||||
|
||||
/// Callback function for debugging.
|
||||
#[cfg(not(feature = "sync"))]
|
||||
|
@ -106,7 +106,7 @@ impl GlobalRuntimeState<'_> {
|
||||
crate::eval::DebuggerStatus::CONTINUE
|
||||
},
|
||||
if let Some((ref init, ..)) = engine.debugger {
|
||||
init()
|
||||
init(engine)
|
||||
} else {
|
||||
Dynamic::UNIT
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user