Fix feature.

This commit is contained in:
Stephen Chung 2022-06-07 20:52:04 +08:00
parent 8501d9d33f
commit 8615960cd6

View File

@ -622,11 +622,14 @@ impl Engine {
match rhs { match rhs {
// Short-circuit for simple property access: {expr}.prop // Short-circuit for simple property access: {expr}.prop
#[cfg(not(feature = "no_object"))]
Expr::Property(..) if chain_type == ChainType::Dotting => { Expr::Property(..) if chain_type == ChainType::Dotting => {
idx_values.push(ChainArgument::Property(rhs.position())) idx_values.push(ChainArgument::Property(rhs.position()))
} }
#[cfg(not(feature = "no_object"))]
Expr::Property(..) => unreachable!("unexpected Expr::Property for indexing"), Expr::Property(..) => unreachable!("unexpected Expr::Property for indexing"),
// Short-circuit for simple method call: {expr}.func() // Short-circuit for simple method call: {expr}.func()
#[cfg(not(feature = "no_object"))]
Expr::FnCall(x, ..) if chain_type == ChainType::Dotting && x.args.is_empty() => { Expr::FnCall(x, ..) if chain_type == ChainType::Dotting && x.args.is_empty() => {
idx_values.push(ChainArgument::MethodCallArgs( idx_values.push(ChainArgument::MethodCallArgs(
Default::default(), Default::default(),
@ -634,6 +637,7 @@ impl Engine {
)) ))
} }
// Short-circuit for method call with all literal arguments: {expr}.func(1, 2, 3) // Short-circuit for method call with all literal arguments: {expr}.func(1, 2, 3)
#[cfg(not(feature = "no_object"))]
Expr::FnCall(x, ..) Expr::FnCall(x, ..)
if chain_type == ChainType::Dotting && x.args.iter().all(Expr::is_constant) => if chain_type == ChainType::Dotting && x.args.iter().all(Expr::is_constant) =>
{ {