Refine auto_restore syntax.

This commit is contained in:
Stephen Chung
2022-12-10 22:37:13 +08:00
parent f15a9a7c9c
commit 8bcb771281
8 changed files with 41 additions and 73 deletions

View File

@@ -725,7 +725,7 @@ impl Engine {
})
});
#[cfg(feature = "debugging")]
auto_restore!(global if reset.is_some() => move |g| g.debugger_mut().reset_status(reset));
auto_restore!(global if Some(reset) => move |g| g.debugger_mut().reset_status(reset));
self.eval_expr(global, caches, scope, this_ptr, arg_expr)
.map(|r| (r, arg_expr.start_position()))
@@ -1549,14 +1549,14 @@ impl Engine {
}
// Normal function call
let (first_arg, args) = args.split_first().map_or_else(
let (first_arg, rest_args) = args.split_first().map_or_else(
|| (None, args.as_ref()),
|(first, rest)| (Some(first), rest),
);
self.make_function_call(
global, caches, scope, this_ptr, name, op_token, first_arg, args, *hashes, *capture,
pos,
global, caches, scope, this_ptr, name, op_token, first_arg, rest_args, *hashes,
*capture, pos,
)
}
}