Revise on_def_var API.

This commit is contained in:
Stephen Chung
2022-02-15 10:56:05 +08:00
parent 5bb6ce835f
commit fb9964e1a3
6 changed files with 59 additions and 29 deletions

View File

@@ -128,7 +128,7 @@ fn test_var_def_filter() -> Result<(), Box<EvalAltResult>> {
let ast = engine.compile("let x = 42;")?;
engine.run_ast(&ast)?;
engine.on_def_var(|name, _, _, scope_level, _, _| match (name, scope_level) {
engine.on_def_var(|_, info, _| match (info.name, info.nesting_level) {
("x", 0 | 1) => Ok(false),
_ => Ok(true),
});