Check for constant values passed to methods.

This commit is contained in:
Stephen Chung
2021-02-19 23:13:53 +08:00
parent ac1b7debe9
commit 182fc2c3d1
13 changed files with 360 additions and 300 deletions

View File

@@ -575,7 +575,7 @@ fn optimize_expr(expr: &mut Expr, state: &mut State) {
Expr::Array(x, _) => x.iter_mut().for_each(|expr| optimize_expr(expr, state)),
// #{ key:constant, .. }
#[cfg(not(feature = "no_object"))]
Expr::Map(_, _) if expr.is_constant()=> {
Expr::Map(_, _) if expr.is_constant() => {
state.set_dirty();
*expr = Expr::DynamicConstant(Box::new(expr.get_constant_value().unwrap()), expr.position());
}