Merge branch 'plugins' into plugins_dev
This commit is contained in:
@@ -340,6 +340,7 @@ pub fn get_script_function_by_signature<'a>(
|
||||
///
|
||||
/// This type is volatile and may change.
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||
pub struct Limits {
|
||||
/// Maximum levels of call-stack to prevent infinite recursion.
|
||||
///
|
||||
|
@@ -12,11 +12,11 @@ use crate::scope::Scope;
|
||||
|
||||
use crate::stdlib::{boxed::Box, string::ToString};
|
||||
|
||||
/// Trait to create a Rust anonymous function from a script.
|
||||
/// Trait to create a Rust closure from a script.
|
||||
pub trait Func<ARGS, RET> {
|
||||
type Output;
|
||||
|
||||
/// Create a Rust anonymous function from an `AST`.
|
||||
/// Create a Rust closure from an `AST`.
|
||||
/// The `Engine` and `AST` are consumed and basically embedded into the closure.
|
||||
///
|
||||
/// # Examples
|
||||
@@ -47,7 +47,7 @@ pub trait Func<ARGS, RET> {
|
||||
/// # }
|
||||
fn create_from_ast(self, ast: AST, entry_point: &str) -> Self::Output;
|
||||
|
||||
/// Create a Rust anonymous function from a script.
|
||||
/// Create a Rust closure from a script.
|
||||
/// The `Engine` is consumed and basically embedded into the closure.
|
||||
///
|
||||
/// # Examples
|
||||
|
@@ -3167,6 +3167,8 @@ fn make_curry_from_externals(
|
||||
let num_externals = externals.len();
|
||||
let mut args: StaticVec<_> = Default::default();
|
||||
|
||||
args.push(fn_expr);
|
||||
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
externals.iter().for_each(|(var_name, pos)| {
|
||||
args.push(Expr::Variable(Box::new((
|
||||
@@ -3182,9 +3184,9 @@ fn make_curry_from_externals(
|
||||
args.push(Expr::Variable(Box::new(((var_name, pos), None, 0, None))));
|
||||
});
|
||||
|
||||
let hash = calc_fn_hash(empty(), KEYWORD_FN_PTR_CURRY, num_externals, empty());
|
||||
let hash = calc_fn_hash(empty(), KEYWORD_FN_PTR_CURRY, num_externals + 1, empty());
|
||||
|
||||
let fn_call = Expr::FnCall(Box::new((
|
||||
let expr = Expr::FnCall(Box::new((
|
||||
(KEYWORD_FN_PTR_CURRY.into(), false, false, pos),
|
||||
None,
|
||||
hash,
|
||||
@@ -3192,8 +3194,6 @@ fn make_curry_from_externals(
|
||||
None,
|
||||
)));
|
||||
|
||||
let expr = Expr::Dot(Box::new((fn_expr, fn_call, pos)));
|
||||
|
||||
// If there are captured variables, convert the entire expression into a statement block,
|
||||
// then insert the relevant `Share` statements.
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
|
Reference in New Issue
Block a user