Add function pointer short-hand.

This commit is contained in:
Stephen Chung
2022-08-05 23:30:44 +08:00
parent ca65e17610
commit d8532b48b6
8 changed files with 68 additions and 13 deletions

View File

@@ -104,6 +104,11 @@ fn test_options_strict_var() -> Result<(), Box<EvalAltResult>> {
#[cfg(not(feature = "no_function"))]
{
assert_eq!(
engine
.eval_with_scope::<INT>(&mut scope, "fn foo(z) { y + z } let f = foo; f.call(x)")?,
42
);
assert!(engine.compile("let f = |y| x * y;").is_err());
#[cfg(not(feature = "no_closure"))]
{