Do not parse closures when allow_anonymous_fn is false.
This commit is contained in:
@@ -11,9 +11,11 @@ In these cases, use the `Engine::compile_expression` and `Engine::eval_expressio
|
||||
let result = engine.eval_expression::<i64>("2 + (10 + 10) * 2")?;
|
||||
```
|
||||
|
||||
When evaluating _expressions_, no full-blown statement (e.g. `if`, `while`, `for`) - not even variable assignment -
|
||||
When evaluating _expressions_, no full-blown statement (e.g. `if`, `while`, `for`, `fn`) - not even variable assignment -
|
||||
is supported and will be considered parse errors when encountered.
|
||||
|
||||
[Closures] and [anonymous functions] are also not supported because in the background they compile to functions.
|
||||
|
||||
```rust
|
||||
// The following are all syntax errors because the script is not an expression.
|
||||
|
||||
|
Reference in New Issue
Block a user