Handle shared for loop variable.
This commit is contained in:
parent
abe74e7f44
commit
3b6d35368f
@ -1701,7 +1701,15 @@ impl Engine {
|
|||||||
state.scope_level += 1;
|
state.scope_level += 1;
|
||||||
|
|
||||||
for loop_var in func(iter_type) {
|
for loop_var in func(iter_type) {
|
||||||
*scope.get_mut(index).0 = loop_var;
|
let for_var = scope.get_mut(index).0;
|
||||||
|
let value = loop_var.clone_inner_data().unwrap();
|
||||||
|
|
||||||
|
if cfg!(not(feature = "no_closure")) && for_var.is_shared() {
|
||||||
|
*for_var.write_lock().unwrap() = value;
|
||||||
|
} else {
|
||||||
|
*for_var = value;
|
||||||
|
}
|
||||||
|
|
||||||
self.inc_operations(state)
|
self.inc_operations(state)
|
||||||
.map_err(|err| err.new_position(stmt.position()))?;
|
.map_err(|err| err.new_position(stmt.position()))?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user