@@ -152,6 +152,24 @@ impl<'a, 's, 'ps, 'g, 'c, 't> EvalContext<'a, 's, 'ps, 'g, 'c, 't> {
152152 pub const fn call_level ( & self ) -> usize {
153153 self . global . level
154154 }
155+ /// _(internals, debugging)_ Debugging interface.
156+ /// Exported under the `debugging` and `internals` features only.
157+ #[ cfg( feature = "debugging" ) ]
158+ #[ cfg( feature = "internals" ) ]
159+ #[ inline( always) ]
160+ #[ must_use]
161+ pub fn debugger ( & self ) -> Option < & crate :: debugger:: Debugger > {
162+ self . global . debugger . as_deref ( )
163+ }
164+ /// _(internals, debugging)_ Mutable reference to the debugging interface.
165+ /// Exported under the `debugging` and `internals` features only.
166+ #[ cfg( feature = "debugging" ) ]
167+ #[ cfg( feature = "internals" ) ]
168+ #[ inline( always) ]
169+ #[ must_use]
170+ pub fn debugger_mut ( & mut self ) -> Option < & mut crate :: debugger:: Debugger > {
171+ self . global . debugger . as_deref_mut ( )
172+ }
155173
156174 /// Evaluate an [expression tree][crate::Expression] within this [evaluation context][`EvalContext`].
157175 ///
@@ -383,12 +401,16 @@ impl<'a, 's, 'ps, 'g, 'c, 't> EvalContext<'a, 's, 'ps, 'g, 'c, 't> {
383401 /// # Examples
384402 ///
385403 /// ```rust,ignore
386- /// // The following disables caching of function resolution results for this frame
387- /// // by pushing a new, empty, caching layer . This is useful if the resolution will be volatile.
404+ /// // The following pushes a new, empty, caching layer to make sure that new function resolutions
405+ /// // do not persist . This is useful if the resolution will be volatile.
388406 /// let result: i64 = context.new_frame()
389407 /// .with_new_caching_layer()
390408 /// .call_fn("foo", (0_i64,))?;
391409 ///
410+ /// // In the above example, the resolution to function 'foo' will not be cached outside the frame.
411+ /// // The next call to 'foo' will be resolved again instead of using the cached resolution,
412+ /// // even if 'foo' is redefined.
413+ ///
392414 /// // The following modifies the [`EvalContext`] before using, restoring its state afterwards.
393415 /// {
394416 /// // Modify the context before using...
@@ -415,7 +437,6 @@ impl<'a, 's, 'ps, 'g, 'c, 't> EvalContext<'a, 's, 'ps, 'g, 'c, 't> {
415437 /// * the original [scope][EvalContext::scope] will be rewound if [`EvalContextFrameGuard::rewind_scope`] was set to `true`.
416438 /// * the [source][GlobalRuntimeState::source] will be restored if a new source was set via [`EvalContextFrameGuard::with_source`] or cleared via [`EvalContextFrameGuard::clear_source`].
417439 /// * the current [nesting level][GlobalRuntimeState::level] of function calls will be restored if modified via [`EvalContextFrameGuard::up_call_level`].
418- /// * the current [scope level][GlobalRuntimeState::scope_level] will be restored if modified via [`EvalContextFrameGuard::up_scope_level`].
419440 /// * the current [`tag`][GlobalRuntimeState::tag] will be restored if modified via [`EvalContextFrameGuard::with_tag`] or [`EvalContextFrameGuard::clear_tag`].
420441 pub fn new_frame < ' f > ( & ' f mut self ) -> EvalContextFrameGuard < ' f , ' a , ' s , ' ps , ' g , ' c , ' t > {
421442 EvalContextFrameGuard {
@@ -430,8 +451,6 @@ impl<'a, 's, 'ps, 'g, 'c, 't> EvalContext<'a, 's, 'ps, 'g, 'c, 't> {
430451 source : None ,
431452 #[ cfg( feature = "internals" ) ]
432453 level : None ,
433- #[ cfg( feature = "internals" ) ]
434- scope_level : None ,
435454 tag : None ,
436455
437456 context : self ,
@@ -520,8 +539,6 @@ pub struct EvalContextFrameGuard<'f, 'a, 's, 'ps, 'g, 'c, 't> {
520539 source : Option < Option < ImmutableString > > ,
521540 #[ cfg( feature = "internals" ) ]
522541 level : Option < usize > ,
523- #[ cfg( feature = "internals" ) ]
524- scope_level : Option < usize > ,
525542 tag : Option < Dynamic > ,
526543}
527544
@@ -551,10 +568,6 @@ impl Drop for EvalContextFrameGuard<'_, '_, '_, '_, '_, '_, '_> {
551568 if let Some ( level) = self . level {
552569 self . context . global . level = level;
553570 }
554- #[ cfg( feature = "internals" ) ]
555- if let Some ( scope_level) = self . scope_level {
556- self . context . global . scope_level = scope_level;
557- }
558571 if let Some ( tag) = self . tag . take ( ) {
559572 * self . context . tag_mut ( ) = tag;
560573 }
@@ -659,13 +672,4 @@ impl<'t> EvalContextFrameGuard<'_, '_, '_, '_, '_, '_, 't> {
659672 self . context . global . level += 1 ;
660673 self
661674 }
662- /// _(internals)_ Increment the current scope level.
663- /// Exported under the `internals` feature only.
664- #[ cfg( feature = "internals" ) ]
665- #[ inline( always) ]
666- pub fn up_scope_level ( mut self ) -> Self {
667- self . scope_level = Some ( self . context . global . scope_level ) ;
668- self . context . global . scope_level += 1 ;
669- self
670- }
671675}
0 commit comments