Make Module::eval_ast_as_new_raw public.

This commit is contained in:
Stephen Chung 2022-04-19 08:28:59 +08:00
parent f9ee0c29be
commit 40c4906336
2 changed files with 19 additions and 4 deletions

View File

@ -9,6 +9,11 @@ Bug fixes
* Compound assignments now work properly with indexers. * 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 Version 1.6.1
============= =============

View File

@ -1742,9 +1742,12 @@ impl Module {
/// Create a new [`Module`] by evaluating an [`AST`][crate::AST]. /// Create a new [`Module`] by evaluating an [`AST`][crate::AST].
/// ///
/// The entire [`AST`][crate::AST] is encapsulated into each function, allowing functions /// The entire [`AST`][crate::AST] is encapsulated into each function, allowing functions to
/// to cross-call each other. Functions in the global namespace, plus all functions /// cross-call each other.
/// defined in the [`Module`], are _merged_ into a _unified_ namespace before each call. ///
/// 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. /// Therefore, all functions will be found.
/// ///
/// # Example /// # Example
@ -1781,8 +1784,15 @@ impl Module {
/// _merged_ into a _unified_ namespace before each call. /// _merged_ into a _unified_ namespace before each call.
/// ///
/// Therefore, all functions will be found. /// 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"))] #[cfg(not(feature = "no_module"))]
pub(crate) fn eval_ast_as_new_raw( pub fn eval_ast_as_new_raw(
engine: &crate::Engine, engine: &crate::Engine,
scope: crate::Scope, scope: crate::Scope,
global: &mut crate::eval::GlobalRuntimeState, global: &mut crate::eval::GlobalRuntimeState,