Encapsulate structures.

This commit is contained in:
Stephen Chung
2020-12-14 23:05:13 +08:00
parent 5ea6efe6fd
commit 17310ef576
4 changed files with 18 additions and 26 deletions

View File

@@ -27,7 +27,7 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
let stmt = inputs.get(1).unwrap();
let condition = inputs.get(2).unwrap();
context.scope.push(var_name, 0 as INT);
context.scope_mut().push(var_name, 0 as INT);
loop {
context.eval_expression_tree(stmt)?;
@@ -110,7 +110,7 @@ fn test_custom_syntax_raw() -> Result<(), Box<EvalAltResult>> {
},
1,
|context, inputs| {
context.scope.push("foo", 999 as INT);
context.scope_mut().push("foo", 999 as INT);
Ok(match inputs[0].get_variable_name().unwrap() {
"world" => 123 as INT,

View File

@@ -71,7 +71,7 @@ fn test_var_resolver() -> Result<(), Box<EvalAltResult>> {
}
// Silently maps 'chameleon' into 'innocent'.
"chameleon" => context
.scope
.scope()
.get_value("innocent")
.map(Some)
.ok_or_else(|| {