Use {} style for auto_restore.

This commit is contained in:
Stephen Chung
2023-03-17 06:15:59 +08:00
parent a3324ceb3d
commit c62162b3c5
5 changed files with 13 additions and 13 deletions

View File

@@ -688,7 +688,7 @@ impl Engine {
let reset =
self.run_debugger_with_reset(global, caches, scope, this_ptr, rhs)?;
#[cfg(feature = "debugging")]
auto_restore!(global if Some(reset) => move |g| g.debugger_mut().reset_status(reset));
auto_restore! { global if Some(reset) => move |g| g.debugger_mut().reset_status(reset) }
let crate::ast::FnCallExpr {
name, hashes, args, ..
@@ -857,7 +857,7 @@ impl Engine {
let reset = self
.run_debugger_with_reset(global, caches, scope, _tp, _node)?;
#[cfg(feature = "debugging")]
auto_restore!(global if Some(reset) => move |g| g.debugger_mut().reset_status(reset));
auto_restore! { global if Some(reset) => move |g| g.debugger_mut().reset_status(reset) }
let crate::ast::FnCallExpr {
name, hashes, args, ..
@@ -977,7 +977,7 @@ impl Engine {
global, caches, scope, _tp, _node,
)?;
#[cfg(feature = "debugging")]
auto_restore!(global if Some(reset) => move |g| g.debugger_mut().reset_status(reset));
auto_restore! { global if Some(reset) => move |g| g.debugger_mut().reset_status(reset) }
let crate::ast::FnCallExpr {
name, hashes, args, ..

View File

@@ -243,7 +243,7 @@ impl Engine {
let reset =
self.run_debugger_with_reset(global, caches, scope, this_ptr.as_deref_mut(), expr)?;
#[cfg(feature = "debugging")]
auto_restore!(global if Some(reset) => move |g| g.debugger_mut().reset_status(reset));
auto_restore! { global if Some(reset) => move |g| g.debugger_mut().reset_status(reset) }
self.track_operation(global, expr.position())?;

View File

@@ -54,7 +54,7 @@ impl Engine {
global.scope_level += 1;
}
auto_restore!(global if restore_orig_state => move |g| {
auto_restore! { global if restore_orig_state => move |g| {
g.scope_level -= 1;
#[cfg(not(feature = "no_module"))]
@@ -63,7 +63,7 @@ impl Engine {
// The impact of new local variables goes away at the end of a block
// because any new variables introduced will go out of scope
g.always_search_scope = orig_always_search_scope;
});
}}
// Pop new function resolution caches at end of block
auto_restore! {
@@ -271,7 +271,7 @@ impl Engine {
let reset =
self.run_debugger_with_reset(global, caches, scope, this_ptr.as_deref_mut(), stmt)?;
#[cfg(feature = "debugging")]
auto_restore!(global if Some(reset) => move |g| g.debugger_mut().reset_status(reset));
auto_restore! { global if Some(reset) => move |g| g.debugger_mut().reset_status(reset) }
self.track_operation(global, stmt.position())?;