From aa6d00f25370b07029b5af5368532264d8343391 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 17 Oct 2020 20:01:31 +0800 Subject: [PATCH] Fix bug. --- src/fn_call.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/fn_call.rs b/src/fn_call.rs index 43cbb9bb..39fbbd7a 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -526,14 +526,18 @@ impl Engine { // Fn/eval - reaching this point it must be a method-style call, mostly like redirected // by a function pointer so it isn't caught at parse time. - KEYWORD_FN_PTR | KEYWORD_EVAL if args.len() == 1 => EvalAltResult::ErrorRuntime( - format!( - "'{}' should not be called in method style. Try {}(...);", - fn_name, fn_name - ), - Position::none(), - ) - .into(), + KEYWORD_FN_PTR | KEYWORD_EVAL + if args.len() == 1 && !self.has_override(lib, hash_fn, hash_script, pub_only) => + { + EvalAltResult::ErrorRuntime( + format!( + "'{}' should not be called in method style. Try {}(...);", + fn_name, fn_name + ), + Position::none(), + ) + .into() + } // Script-like function found #[cfg(not(feature = "no_function"))]