Forbid shadowing of state variable.

This commit is contained in:
Stephen Chung
2022-02-27 22:47:13 +08:00
parent b17e891b63
commit 15448bf660
3 changed files with 7 additions and 1 deletions

View File

@@ -56,7 +56,11 @@ pub fn main() {
};
// Create Engine
let engine = Engine::new();
let mut engine = Engine::new();
// Prevent shadowing of `state`
#[allow(deprecated)]
engine.on_def_var(|_, info, _| Ok(info.name != "state"));
// Create a custom 'Scope' to hold state
let mut scope = Scope::new();