More code refactor.

This commit is contained in:
Stephen Chung
2022-11-25 20:42:16 +08:00
parent fbe30b8d0e
commit d645d8271c
30 changed files with 422 additions and 434 deletions

View File

@@ -147,7 +147,7 @@ pub struct Engine {
/// Callback closure for debugging.
#[cfg(feature = "debugging")]
pub(crate) debugger: Option<
pub(crate) debugger_interface: Option<
Box<(
Box<crate::eval::OnDebuggingInit>,
Box<crate::eval::OnDebuggerCallback>,
@@ -305,7 +305,7 @@ impl Engine {
limits: crate::api::limits::Limits::new(),
#[cfg(feature = "debugging")]
debugger: None,
debugger_interface: None,
};
// Add the global namespace module
@@ -348,4 +348,12 @@ impl Engine {
pub fn const_empty_string(&self) -> ImmutableString {
self.get_interned_string("")
}
/// Is there a debugger interface registered with this [`Engine`]?
#[cfg(feature = "debugging")]
#[inline(always)]
#[must_use]
pub(crate) const fn is_debugger_registered(&self) -> bool {
self.debugger_interface.is_some()
}
}