Move encapsulated environment out of ScriptFnDef.

This commit is contained in:
Stephen Chung
2022-12-12 16:06:24 +08:00
parent 397b5eb39d
commit 67a7ab4069
14 changed files with 116 additions and 79 deletions

View File

@@ -750,10 +750,8 @@ impl AST {
#[cfg(feature = "internals")]
#[cfg(not(feature = "no_function"))]
#[inline]
pub fn iter_fn_def(&self) -> impl Iterator<Item = &super::ScriptFnDef> {
self.lib
.iter_script_fn()
.map(|(.., fn_def)| fn_def.as_ref())
pub fn iter_fn_def(&self) -> impl Iterator<Item = &crate::Shared<super::ScriptFnDef>> {
self.lib.iter_script_fn().map(|(.., fn_def)| fn_def)
}
/// Iterate through all function definitions.
///
@@ -762,10 +760,8 @@ impl AST {
#[cfg(not(feature = "no_function"))]
#[allow(dead_code)]
#[inline]
pub(crate) fn iter_fn_def(&self) -> impl Iterator<Item = &super::ScriptFnDef> {
self.lib
.iter_script_fn()
.map(|(.., fn_def)| fn_def.as_ref())
pub(crate) fn iter_fn_def(&self) -> impl Iterator<Item = &crate::Shared<super::ScriptFnDef>> {
self.lib.iter_script_fn().map(|(.., fn_def)| fn_def)
}
/// Iterate through all function definitions.
///