Remove constants in function call expressions.

This commit is contained in:
Stephen Chung
2022-03-05 12:06:47 +08:00
parent 0335035b0f
commit e06c2b2abb
7 changed files with 77 additions and 124 deletions

View File

@@ -684,16 +684,13 @@ impl Engine {
Expr::MethodCall(x, ..)
if _parent_chain_type == ChainType::Dotting && !x.is_qualified() =>
{
let crate::ast::FnCallExpr {
args, constants, ..
} = x.as_ref();
let crate::ast::FnCallExpr { args, .. } = x.as_ref();
let (values, pos) = args.iter().try_fold(
(crate::FnArgsVec::with_capacity(args.len()), Position::NONE),
|(mut values, mut pos), expr| {
let (value, arg_pos) = self.get_arg_value(
scope, global, state, lib, this_ptr, expr, constants, level,
)?;
let (value, arg_pos) =
self.get_arg_value(scope, global, state, lib, this_ptr, expr, level)?;
if values.is_empty() {
pos = arg_pos;
}
@@ -732,15 +729,13 @@ impl Engine {
Expr::MethodCall(x, ..)
if _parent_chain_type == ChainType::Dotting && !x.is_qualified() =>
{
let crate::ast::FnCallExpr {
args, constants, ..
} = x.as_ref();
let crate::ast::FnCallExpr { args, .. } = x.as_ref();
let (values, pos) = args.iter().try_fold(
(crate::FnArgsVec::with_capacity(args.len()), Position::NONE),
|(mut values, mut pos), expr| {
let (value, arg_pos) = self.get_arg_value(
scope, global, state, lib, this_ptr, expr, constants, level,
scope, global, state, lib, this_ptr, expr, level,
)?;
if values.is_empty() {
pos = arg_pos