Hard code constant checking.

This commit is contained in:
Stephen Chung
2022-12-03 16:20:13 +08:00
parent ffc8a7f85c
commit 55922b5c20
16 changed files with 474 additions and 374 deletions

View File

@@ -142,7 +142,7 @@ impl Engine {
let args = &mut [&mut *lock_guard, &mut new_val];
if self.fast_operators() {
if let Some(func) =
if let Some((func, ctx)) =
get_builtin_op_assignment_fn(op_assign_token.clone(), args[0], args[1])
{
// Built-in found
@@ -152,7 +152,11 @@ impl Engine {
global.level += 1;
let global = &*RestoreOnDrop::lock(global, move |g| g.level = orig_level);
let context = (self, op, None, global, *op_pos).into();
let context = if ctx {
Some((self, op, None, global, *op_pos).into())
} else {
None
};
return func(context, args).map(|_| ());
}
}