Reverse function call parameter change.
This commit is contained in:
parent
21b989afd5
commit
6d0851de44
@ -456,8 +456,6 @@ impl Engine {
|
|||||||
/// Perform an actual function call, native Rust or scripted, taking care of special functions.
|
/// Perform an actual function call, native Rust or scripted, taking care of special functions.
|
||||||
/// Position in `EvalAltResult` is `None` and must be set afterwards.
|
/// Position in `EvalAltResult` is `None` and must be set afterwards.
|
||||||
///
|
///
|
||||||
/// Capture `Scope` is consumed by this function.
|
|
||||||
///
|
|
||||||
/// ## WARNING
|
/// ## WARNING
|
||||||
///
|
///
|
||||||
/// Function call arguments may be _consumed_ when the function requires them to be passed by value.
|
/// Function call arguments may be _consumed_ when the function requires them to be passed by value.
|
||||||
@ -473,7 +471,7 @@ impl Engine {
|
|||||||
is_ref: bool,
|
is_ref: bool,
|
||||||
_is_method: bool,
|
_is_method: bool,
|
||||||
pub_only: bool,
|
pub_only: bool,
|
||||||
_capture: Option<&mut Scope>, // `Scope` is consumed.
|
_capture: Option<Scope>,
|
||||||
def_val: &Option<Dynamic>,
|
def_val: &Option<Dynamic>,
|
||||||
_level: usize,
|
_level: usize,
|
||||||
) -> Result<(Dynamic, bool), Box<EvalAltResult>> {
|
) -> Result<(Dynamic, bool), Box<EvalAltResult>> {
|
||||||
@ -553,7 +551,7 @@ impl Engine {
|
|||||||
#[cfg(not(feature = "no_closure"))]
|
#[cfg(not(feature = "no_closure"))]
|
||||||
if let Some(captured) = _capture {
|
if let Some(captured) = _capture {
|
||||||
captured
|
captured
|
||||||
.iter_mut()
|
.into_iter()
|
||||||
.filter(|ScopeEntry { name, .. }| {
|
.filter(|ScopeEntry { name, .. }| {
|
||||||
func.externals.contains(name.as_ref())
|
func.externals.contains(name.as_ref())
|
||||||
})
|
})
|
||||||
@ -563,11 +561,9 @@ impl Engine {
|
|||||||
}| {
|
}| {
|
||||||
// Consume the scope values.
|
// Consume the scope values.
|
||||||
match typ {
|
match typ {
|
||||||
ScopeEntryType::Normal => {
|
ScopeEntryType::Normal => scope.push(name, value),
|
||||||
scope.push(name.clone(), mem::take(value))
|
|
||||||
}
|
|
||||||
ScopeEntryType::Constant => {
|
ScopeEntryType::Constant => {
|
||||||
scope.push_constant(name.clone(), mem::take(value))
|
scope.push_constant(name, value)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -1013,13 +1009,11 @@ impl Engine {
|
|||||||
let mut arg_values: StaticVec<_>;
|
let mut arg_values: StaticVec<_>;
|
||||||
let mut args: StaticVec<_>;
|
let mut args: StaticVec<_>;
|
||||||
let mut is_ref = false;
|
let mut is_ref = false;
|
||||||
let mut capture_scope = if cfg!(not(feature = "no_closure")) && capture && !scope.is_empty()
|
let capture = if cfg!(not(feature = "no_closure")) && capture && !scope.is_empty() {
|
||||||
{
|
|
||||||
Some(scope.clone_visible())
|
Some(scope.clone_visible())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
let capture = capture_scope.as_mut();
|
|
||||||
|
|
||||||
if args_expr.is_empty() && curry.is_empty() {
|
if args_expr.is_empty() && curry.is_empty() {
|
||||||
// No arguments
|
// No arguments
|
||||||
|
@ -488,12 +488,6 @@ impl<'a> Scope<'a> {
|
|||||||
}| { (name.as_ref(), typ.is_constant(), value) },
|
}| { (name.as_ref(), typ.is_constant(), value) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a mutable iterator to entries in the Scope.
|
|
||||||
#[inline(always)]
|
|
||||||
pub(crate) fn iter_mut(&mut self) -> impl Iterator<Item = &mut Entry<'a>> {
|
|
||||||
self.0.iter_mut()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K: Into<Cow<'a, str>>> iter::Extend<(K, EntryType, Dynamic)> for Scope<'a> {
|
impl<'a, K: Into<Cow<'a, str>>> iter::Extend<(K, EntryType, Dynamic)> for Scope<'a> {
|
||||||
|
Loading…
Reference in New Issue
Block a user