diff --git a/RELEASES.md b/RELEASES.md index 4649f7a5..a980377e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -9,6 +9,7 @@ Breaking changes * `AST::iter_functions` now returns an iterator instead of taking a closure. * `Module::iter_script_fn_info` is removed and merged into `Module::iter_script_fn`. +* `Module::get_script_function_by_signature` renamed to `Module::get_script_fn` and returns `&>`. * The `merge_namespaces` parameter to `Module::eval_ast_as_new` is removed and now defaults to `true`. * `GlobalFileModuleResolver` is removed because its performance gain over the `FileModuleResolver` is no longer very significant. * The following `EvalAltResult` variants are removed and merged into `EvalAltResult::ErrorMismatchDataType`: `ErrorCharMismatch`, `ErrorNumericIndexExpr`, `ErrorStringIndexExpr`, `ErrorImportExpr`, `ErrorLogicGuard`, `ErrorBooleanArgMismatch` @@ -18,7 +19,6 @@ New features * `OptimizationLevel::Simple` now eagerly evaluates built-in binary operators of primary types (if not overloaded). * Added `is_def_var()` to detect if variable is defined, and `is_def_fn()` to detect if script function is defined. -* Added `Module::get_script_fn` to get a scripted function in a module, if any, based on name and number of parameters. Version 0.19.0 diff --git a/src/api.rs b/src/api.rs index b24b3b95..4e772f27 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1596,7 +1596,7 @@ impl Engine { args: &mut [&mut Dynamic], ) -> FuncReturn { let fn_def = lib - .get_script_function_by_signature(name, args.len(), true) + .get_script_fn(name, args.len(), true) .ok_or_else(|| EvalAltResult::ErrorFunctionNotFound(name.into(), Position::none()))?; let mut state = State::new(); diff --git a/src/module/mod.rs b/src/module/mod.rs index 606f7e95..47bfc398 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -1103,24 +1103,6 @@ impl Module { } } - /// Get a script-defined function definition from a module. - #[cfg(not(feature = "no_function"))] - pub fn get_script_function_by_signature( - &self, - name: &str, - num_params: usize, - pub_only: bool, - ) -> Option<&ScriptFnDef> { - // Qualifiers (none) + function name + number of arguments. - let hash_script = calc_fn_hash(empty(), name, num_params, empty()); - let func = self.get_fn(hash_script, pub_only)?; - if func.is_script() { - Some(func.get_fn_def()) - } else { - None - } - } - /// Get a modules-qualified function. /// Name and Position in `EvalAltResult` are None and must be set afterwards. ///