Hard code constant checking.
This commit is contained in:
@@ -1137,8 +1137,12 @@ fn optimize_expr(expr: &mut Expr, state: &mut OptimizerState, _chaining: bool) {
|
||||
// Overloaded operators can override built-in.
|
||||
_ if x.args.len() == 2 && x.op_token != Token::NONE && (state.engine.fast_operators() || !state.engine.has_native_fn_override(x.hashes.native(), &arg_types)) => {
|
||||
if let Some(result) = get_builtin_binary_op_fn(x.op_token.clone(), &arg_values[0], &arg_values[1])
|
||||
.and_then(|f| {
|
||||
let context = (state.engine, x.name.as_str(),None, &state.global, *pos).into();
|
||||
.and_then(|(f, ctx)| {
|
||||
let context = if ctx {
|
||||
Some((state.engine, x.name.as_str(),None, &state.global, *pos).into())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let (first, second) = arg_values.split_first_mut().unwrap();
|
||||
(f)(context, &mut [ first, &mut second[0] ]).ok()
|
||||
}) {
|
||||
|
Reference in New Issue
Block a user