Fix bug with eager optimization of method calls.

This commit is contained in:
Stephen Chung
2022-03-04 12:22:44 +08:00
parent 14e23ed74c
commit 0335035b0f
6 changed files with 76 additions and 40 deletions

View File

@@ -521,8 +521,8 @@ impl Engine {
namespace,
hashes,
args,
constants: StaticVec::new_const(),
pos: settings.pos,
..Default::default()
}
.into_fn_call_expr(settings.pos));
}
@@ -586,8 +586,8 @@ impl Engine {
namespace,
hashes,
args,
constants: StaticVec::new_const(),
pos: settings.pos,
..Default::default()
}
.into_fn_call_expr(settings.pos));
}
@@ -1990,7 +1990,7 @@ impl Engine {
calc_fn_hash(&func.name, func.args.len() + 1),
);
let rhs = Expr::FnCall(func, func_pos);
let rhs = Expr::MethodCall(func, func_pos);
Ok(Expr::Dot(
BinaryExpr { lhs, rhs }.into(),
ASTFlags::NONE,
@@ -2046,7 +2046,7 @@ impl Engine {
);
let new_lhs = BinaryExpr {
lhs: Expr::FnCall(func, func_pos),
lhs: Expr::MethodCall(func, func_pos),
rhs: x.rhs,
}
.into();