From bffc73435c28ef8cd2f848bcbe2a0f380cfd52f0 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 12 Nov 2021 13:02:16 +0800 Subject: [PATCH] Remove externals from ScriptFnDef. --- src/ast.rs | 5 ----- src/optimize.rs | 2 -- src/parse.rs | 13 ------------- 3 files changed, 20 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index d3d0e267..c5409298 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -66,11 +66,6 @@ pub struct ScriptFnDef { pub access: FnAccess, /// Names of function parameters. pub params: StaticVec, - /// Access to external variables. - /// - /// Not available under `no_closure`. - #[cfg(not(feature = "no_closure"))] - pub externals: std::collections::BTreeSet, /// _(metadata)_ Function doc-comments (if any). /// Exported under the `metadata` feature only. /// diff --git a/src/optimize.rs b/src/optimize.rs index 7bed6a15..12699422 100644 --- a/src/optimize.rs +++ b/src/optimize.rs @@ -1160,8 +1160,6 @@ pub fn optimize_into_ast( access: fn_def.access, body: crate::ast::StmtBlock::empty(), params: fn_def.params.clone(), - #[cfg(not(feature = "no_closure"))] - externals: fn_def.externals.clone(), lib: None, #[cfg(not(feature = "no_module"))] mods: crate::engine::Imports::new(), diff --git a/src/parse.rs b/src/parse.rs index daf8aab1..3d1f8a71 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -3068,21 +3068,10 @@ fn parse_fn( let mut params: StaticVec<_> = params.into_iter().map(|(p, _)| p).collect(); params.shrink_to_fit(); - #[cfg(not(feature = "no_closure"))] - let externals = state - .external_vars - .iter() - .map(|(name, _)| name) - .filter(|name| !params.contains(name)) - .cloned() - .collect(); - Ok(ScriptFnDef { name: state.get_identifier(name), access, params, - #[cfg(not(feature = "no_closure"))] - externals, body, lib: None, #[cfg(not(feature = "no_module"))] @@ -3228,8 +3217,6 @@ fn parse_anon_fn( name: fn_name.clone(), access: FnAccess::Public, params, - #[cfg(not(feature = "no_closure"))] - externals: std::collections::BTreeSet::new(), body: body.into(), lib: None, #[cfg(not(feature = "no_module"))]