Minor cleanup before release.

This commit is contained in:
Stephen Chung
2020-10-22 12:26:44 +08:00
parent e89d12c42f
commit 2c7c719cd5
16 changed files with 125 additions and 120 deletions

View File

@@ -1695,11 +1695,11 @@ impl Engine {
// Normal function call
Expr::FnCall(x) if x.1.is_none() => {
let ((name, native, capture, pos), _, hash, args_expr, def_val) = x.as_ref();
let ((name, native, cap_scope, pos), _, hash, args_expr, def_val) = x.as_ref();
let def_val = def_val.map(Into::<Dynamic>::into);
self.make_function_call(
scope, mods, state, lib, this_ptr, name, args_expr, &def_val, *hash, *native,
false, *capture, level,
false, *cap_scope, level,
)
.map_err(|err| err.fill_position(*pos))
}

View File

@@ -490,7 +490,7 @@ impl Engine {
is_ref: bool,
_is_method: bool,
pub_only: bool,
_capture: Option<Scope>,
_capture_scope: Option<Scope>,
def_val: &Option<Dynamic>,
_level: usize,
) -> Result<(Dynamic, bool), Box<EvalAltResult>> {
@@ -562,7 +562,7 @@ impl Engine {
// Move captured variables into scope
#[cfg(not(feature = "no_closure"))]
if let Some(captured) = _capture {
if let Some(captured) = _capture_scope {
captured
.into_iter()
.filter(|ScopeEntry { name, .. }| {
@@ -868,7 +868,7 @@ impl Engine {
mut hash_script: u64,
native: bool,
pub_only: bool,
capture: bool,
capture_scope: bool,
level: usize,
) -> Result<Dynamic, Box<EvalAltResult>> {
let args_expr = args_expr.as_ref();
@@ -1043,7 +1043,7 @@ impl Engine {
let mut arg_values: StaticVec<_>;
let mut args: StaticVec<_>;
let mut is_ref = false;
let capture = if cfg!(not(feature = "no_closure")) && capture && !scope.is_empty() {
let capture = if capture_scope && !scope.is_empty() {
Some(scope.clone_visible())
} else {
None

View File

@@ -16,7 +16,7 @@ use crate::stdlib::{boxed::Box, collections::HashMap, ops::AddAssign, string::St
/// let mut resolver = StaticModuleResolver::new();
///
/// let module = Module::new();
/// resolver.insert("hello".to_string(), module);
/// resolver.insert("hello", module);
///
/// let mut engine = Engine::new();
///

View File

@@ -1998,7 +1998,6 @@ fn parse_primary(
root_expr = match (root_expr, token) {
// Qualified function call with !
#[cfg(not(feature = "no_closure"))]
(Expr::Variable(x), Token::Bang) if x.1.is_some() => {
return Err(if !match_token(input, Token::LeftParen).0 {
LexError::UnexpectedInput(Token::Bang.syntax().to_string()).into_err(token_pos)
@@ -2008,7 +2007,6 @@ fn parse_primary(
});
}
// Function call with !
#[cfg(not(feature = "no_closure"))]
(Expr::Variable(x), Token::Bang) => {
let (matched, pos) = match_token(input, Token::LeftParen);
if !matched {