From 40c49063362205e4c096ce9a22415e59c2e6b7ec Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 19 Apr 2022 08:28:59 +0800 Subject: [PATCH] Make Module::eval_ast_as_new_raw public. --- CHANGELOG.md | 5 +++++ src/module/mod.rs | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 670fde5b..81b7cd2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ Bug fixes * Compound assignments now work properly with indexers. +Enhancements +------------ + +* `Module::eval_ast_as_new_raw` is made public as a low-level API. + Version 1.6.1 ============= diff --git a/src/module/mod.rs b/src/module/mod.rs index 1b1051af..ea9b7ebe 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -1742,9 +1742,12 @@ impl Module { /// Create a new [`Module`] by evaluating an [`AST`][crate::AST]. /// - /// The entire [`AST`][crate::AST] is encapsulated into each function, allowing functions - /// to cross-call each other. Functions in the global namespace, plus all functions - /// defined in the [`Module`], are _merged_ into a _unified_ namespace before each call. + /// The entire [`AST`][crate::AST] is encapsulated into each function, allowing functions to + /// cross-call each other. + /// + /// Functions in the global namespace, plus all functions defined in the [`Module`], are + /// _merged_ into a _unified_ namespace before each call. + /// /// Therefore, all functions will be found. /// /// # Example @@ -1781,8 +1784,15 @@ impl Module { /// _merged_ into a _unified_ namespace before each call. /// /// Therefore, all functions will be found. + /// + /// # WARNING - Low Level API + /// + /// This function is very low level. + /// + /// In particular, the [`global`][crate::eval::GlobalRuntimeState] parameter allows the + /// entire calling environment to be encapsulated, including automatic global constants. #[cfg(not(feature = "no_module"))] - pub(crate) fn eval_ast_as_new_raw( + pub fn eval_ast_as_new_raw( engine: &crate::Engine, scope: crate::Scope, global: &mut crate::eval::GlobalRuntimeState,