Change output of AST::iter_functions.
This commit is contained in:
16
src/ast.rs
16
src/ast.rs
@@ -82,7 +82,7 @@ pub struct ScriptFnDef {
|
||||
pub params: StaticVec<ImmutableString>,
|
||||
/// Access to external variables.
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
pub externals: crate::stdlib::collections::HashSet<ImmutableString>,
|
||||
pub externals: Vec<ImmutableString>,
|
||||
}
|
||||
|
||||
impl fmt::Display for ScriptFnDef {
|
||||
@@ -501,8 +501,18 @@ impl AST {
|
||||
#[inline(always)]
|
||||
pub fn iter_functions<'a>(
|
||||
&'a self,
|
||||
) -> impl Iterator<Item = (FnNamespace, FnAccess, &str, usize, &ScriptFnDef)> + 'a {
|
||||
self.functions.iter_script_fn()
|
||||
) -> impl Iterator<Item = (FnNamespace, FnAccess, &str, usize, &[ImmutableString])> + 'a {
|
||||
self.functions
|
||||
.iter_script_fn()
|
||||
.map(|(namespace, access, name, num_params, fn_def)| {
|
||||
(
|
||||
namespace,
|
||||
access,
|
||||
name,
|
||||
num_params,
|
||||
fn_def.params.as_slice(),
|
||||
)
|
||||
})
|
||||
}
|
||||
/// Clear all function definitions in the [`AST`].
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
|
@@ -539,7 +539,7 @@ impl Engine {
|
||||
if !func.externals.is_empty() {
|
||||
captured
|
||||
.into_iter()
|
||||
.filter(|(name, _, _)| func.externals.contains(name.as_ref()))
|
||||
.filter(|(name, _, _)| func.externals.iter().any(|ex| ex == name))
|
||||
.for_each(|(name, value, _)| {
|
||||
// Consume the scope values.
|
||||
scope.push_dynamic(name, value);
|
||||
|
Reference in New Issue
Block a user