Refine auto_restore syntax.

This commit is contained in:
Stephen Chung
2022-12-04 22:47:10 +08:00
parent 3163d9d1d6
commit e2bd0705b1
7 changed files with 64 additions and 32 deletions

View File

@@ -238,8 +238,10 @@ impl Engine {
let rewind_scope = options.rewind_scope;
let result = if options.eval_ast && !statements.is_empty() {
let orig_scope_len = scope.len();
auto_restore!(scope; rewind_scope => move |s| { s.rewind(orig_scope_len); });
auto_restore! {
scope if rewind_scope => rewind;
let orig_scope_len = scope.len();
}
self.eval_global_statements(global, caches, scope, statements)
} else {