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

@@ -129,7 +129,8 @@ impl Engine {
let args = &mut [&mut *lock_guard, &mut new_val];
if self.fast_operators() {
if let Some(func) = get_builtin_op_assignment_fn(op_assign_token, args[0], args[1])
if let Some(func) =
get_builtin_op_assignment_fn(op_assign_token.clone(), args[0], args[1])
{
// Built-in found
let op = op_assign_token.literal_syntax();
@@ -145,7 +146,7 @@ impl Engine {
let op_assign = op_assign_token.literal_syntax();
let op = op_token.literal_syntax();
let token = Some(op_assign_token);
let token = op_assign_token.clone();
match self
.exec_native_fn_call(global, caches, op_assign, token, hash, args, true, *op_pos)
@@ -154,7 +155,7 @@ impl Engine {
Err(err) if matches!(*err, ERR::ErrorFunctionNotFound(ref f, ..) if f.starts_with(op_assign)) =>
{
// Expand to `var = var op rhs`
let token = Some(op_token);
let token = op_token.clone();
*args[0] = self
.exec_native_fn_call(