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.
|
* 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.
|
* 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
|
New features
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ impl Engine {
|
|||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn register_debugger(
|
pub fn register_debugger(
|
||||||
&mut self,
|
&mut self,
|
||||||
init: impl Fn() -> Dynamic + SendSync + 'static,
|
init: impl Fn(&Engine) -> Dynamic + SendSync + 'static,
|
||||||
callback: impl Fn(
|
callback: impl Fn(
|
||||||
EvalContext,
|
EvalContext,
|
||||||
crate::eval::DebuggerEvent,
|
crate::eval::DebuggerEvent,
|
||||||
|
@ -611,7 +611,7 @@ fn main() {
|
|||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
engine.register_debugger(
|
engine.register_debugger(
|
||||||
// Store the current source in the debugger state
|
// Store the current source in the debugger state
|
||||||
|| "".into(),
|
|_| "".into(),
|
||||||
// Main debugging interface
|
// Main debugging interface
|
||||||
move |context, event, node, source, pos| {
|
move |context, event, node, source, pos| {
|
||||||
debug_callback(context, event, node, source, pos, &lines)
|
debug_callback(context, event, node, source, pos, &lines)
|
||||||
|
@ -10,10 +10,10 @@ use std::{fmt, iter::repeat, mem};
|
|||||||
|
|
||||||
/// Callback function to initialize the debugger.
|
/// Callback function to initialize the debugger.
|
||||||
#[cfg(not(feature = "sync"))]
|
#[cfg(not(feature = "sync"))]
|
||||||
pub type OnDebuggingInit = dyn Fn() -> Dynamic;
|
pub type OnDebuggingInit = dyn Fn(&Engine) -> Dynamic;
|
||||||
/// Callback function to initialize the debugger.
|
/// Callback function to initialize the debugger.
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
pub type OnDebuggingInit = dyn Fn() -> Dynamic + Send + Sync;
|
pub type OnDebuggingInit = dyn Fn(&Engine) -> Dynamic + Send + Sync;
|
||||||
|
|
||||||
/// Callback function for debugging.
|
/// Callback function for debugging.
|
||||||
#[cfg(not(feature = "sync"))]
|
#[cfg(not(feature = "sync"))]
|
||||||
|
@ -106,7 +106,7 @@ impl GlobalRuntimeState<'_> {
|
|||||||
crate::eval::DebuggerStatus::CONTINUE
|
crate::eval::DebuggerStatus::CONTINUE
|
||||||
},
|
},
|
||||||
if let Some((ref init, ..)) = engine.debugger {
|
if let Some((ref init, ..)) = engine.debugger {
|
||||||
init()
|
init(engine)
|
||||||
} else {
|
} else {
|
||||||
Dynamic::UNIT
|
Dynamic::UNIT
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user