Minor refactor.

This commit is contained in:
Stephen Chung
2021-12-02 12:49:46 +08:00
parent 4b4b7a753b
commit d36e2d22d1
4 changed files with 8 additions and 9 deletions

View File

@@ -313,7 +313,7 @@ impl Engine {
name: impl AsRef<str>,
hash: u64,
args: &mut FnCallArgs,
is_method_call: bool,
is_ref_mut: bool,
is_op_assign: bool,
pos: Position,
) -> Result<(Dynamic, bool), Box<EvalAltResult>> {
@@ -331,7 +331,8 @@ impl Engine {
// Calling pure function but the first argument is a reference?
let mut backup: Option<ArgBackup> = None;
if is_method_call && func.is_pure() && !args.is_empty() {
if is_ref_mut && func.is_pure() && !args.is_empty() {
// Clone the first argument
backup = Some(ArgBackup::new());
backup
.as_mut()
@@ -397,6 +398,8 @@ impl Engine {
});
}
// Error handling
match name {
// index getter function not found?
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]