Streamline data types.

This commit is contained in:
Stephen Chung
2023-04-10 18:47:53 +08:00
parent ac52d3cd87
commit 26ad454cb1
6 changed files with 44 additions and 48 deletions

View File

@@ -927,10 +927,10 @@ impl Engine {
// Share statement
#[cfg(not(feature = "no_closure"))]
Stmt::Share(x) => {
for (name, index, pos) in &**x {
for (var, index) in &**x {
if let Some(index) = index
.map(|n| scope.len() - n.get())
.or_else(|| scope.search(name))
.or_else(|| scope.search(&var.name))
{
let val = scope.get_mut_by_index(index);
@@ -939,7 +939,9 @@ impl Engine {
*val = std::mem::take(val).into_shared();
}
} else {
return Err(ERR::ErrorVariableNotFound(name.to_string(), *pos).into());
return Err(
ERR::ErrorVariableNotFound(var.name.to_string(), var.pos).into()
);
}
}