Forbid shadowing of state variable.
This commit is contained in:
parent
b17e891b63
commit
15448bf660
@ -26,6 +26,7 @@ Enhancements
|
|||||||
|
|
||||||
* Variable definitions are optimized so that shadowed variables are reused as much as possible to reduce memory consumption.
|
* Variable definitions are optimized so that shadowed variables are reused as much as possible to reduce memory consumption.
|
||||||
* `FnAccess` and `FnNamespace` now implement `Ord` and `PartialOrd`.
|
* `FnAccess` and `FnNamespace` now implement `Ord` and `PartialOrd`.
|
||||||
|
* The `event_handler_map` example is enhanced to prevent shadowing of the state object map.
|
||||||
|
|
||||||
|
|
||||||
Version 1.5.0
|
Version 1.5.0
|
||||||
|
@ -56,7 +56,11 @@ pub fn main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create Engine
|
// 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
|
// Create a custom 'Scope' to hold state
|
||||||
let mut scope = Scope::new();
|
let mut scope = Scope::new();
|
||||||
|
@ -47,6 +47,7 @@ fn main() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Initialize scripting engine
|
||||||
let mut engine = Engine::new();
|
let mut engine = Engine::new();
|
||||||
|
|
||||||
#[cfg(not(feature = "no_optimize"))]
|
#[cfg(not(feature = "no_optimize"))]
|
||||||
|
Loading…
Reference in New Issue
Block a user