Remove externals from ScriptFnDef.
This commit is contained in:
parent
7f34e4ad99
commit
bffc73435c
@ -66,11 +66,6 @@ pub struct ScriptFnDef {
|
|||||||
pub access: FnAccess,
|
pub access: FnAccess,
|
||||||
/// Names of function parameters.
|
/// Names of function parameters.
|
||||||
pub params: StaticVec<Identifier>,
|
pub params: StaticVec<Identifier>,
|
||||||
/// Access to external variables.
|
|
||||||
///
|
|
||||||
/// Not available under `no_closure`.
|
|
||||||
#[cfg(not(feature = "no_closure"))]
|
|
||||||
pub externals: std::collections::BTreeSet<Identifier>,
|
|
||||||
/// _(metadata)_ Function doc-comments (if any).
|
/// _(metadata)_ Function doc-comments (if any).
|
||||||
/// Exported under the `metadata` feature only.
|
/// Exported under the `metadata` feature only.
|
||||||
///
|
///
|
||||||
|
@ -1160,8 +1160,6 @@ pub fn optimize_into_ast(
|
|||||||
access: fn_def.access,
|
access: fn_def.access,
|
||||||
body: crate::ast::StmtBlock::empty(),
|
body: crate::ast::StmtBlock::empty(),
|
||||||
params: fn_def.params.clone(),
|
params: fn_def.params.clone(),
|
||||||
#[cfg(not(feature = "no_closure"))]
|
|
||||||
externals: fn_def.externals.clone(),
|
|
||||||
lib: None,
|
lib: None,
|
||||||
#[cfg(not(feature = "no_module"))]
|
#[cfg(not(feature = "no_module"))]
|
||||||
mods: crate::engine::Imports::new(),
|
mods: crate::engine::Imports::new(),
|
||||||
|
13
src/parse.rs
13
src/parse.rs
@ -3068,21 +3068,10 @@ fn parse_fn(
|
|||||||
let mut params: StaticVec<_> = params.into_iter().map(|(p, _)| p).collect();
|
let mut params: StaticVec<_> = params.into_iter().map(|(p, _)| p).collect();
|
||||||
params.shrink_to_fit();
|
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 {
|
Ok(ScriptFnDef {
|
||||||
name: state.get_identifier(name),
|
name: state.get_identifier(name),
|
||||||
access,
|
access,
|
||||||
params,
|
params,
|
||||||
#[cfg(not(feature = "no_closure"))]
|
|
||||||
externals,
|
|
||||||
body,
|
body,
|
||||||
lib: None,
|
lib: None,
|
||||||
#[cfg(not(feature = "no_module"))]
|
#[cfg(not(feature = "no_module"))]
|
||||||
@ -3228,8 +3217,6 @@ fn parse_anon_fn(
|
|||||||
name: fn_name.clone(),
|
name: fn_name.clone(),
|
||||||
access: FnAccess::Public,
|
access: FnAccess::Public,
|
||||||
params,
|
params,
|
||||||
#[cfg(not(feature = "no_closure"))]
|
|
||||||
externals: std::collections::BTreeSet::new(),
|
|
||||||
body: body.into(),
|
body: body.into(),
|
||||||
lib: None,
|
lib: None,
|
||||||
#[cfg(not(feature = "no_module"))]
|
#[cfg(not(feature = "no_module"))]
|
||||||
|
Loading…
Reference in New Issue
Block a user