Scope::clone_visible clones value access mode also.
This commit is contained in:
parent
14e42f436f
commit
538af8caee
@ -4,6 +4,11 @@ Rhai Release Notes
|
||||
Version 1.5.0
|
||||
=============
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
|
||||
* In `Scope::clone_visible`, constants are now properly cloned as constants.
|
||||
|
||||
New features
|
||||
------------
|
||||
|
||||
|
@ -534,8 +534,12 @@ impl Scope<'_> {
|
||||
Self::new(),
|
||||
|mut entries, (index, (name, alias))| {
|
||||
if !entries.names.iter().any(|(key, _)| key == name) {
|
||||
let orig_value = &self.values[len - 1 - index];
|
||||
let mut value = orig_value.clone();
|
||||
value.set_access_mode(orig_value.access_mode());
|
||||
|
||||
entries.names.push((name.clone(), alias.clone()));
|
||||
entries.values.push(self.values[len - 1 - index].clone());
|
||||
entries.values.push(value);
|
||||
}
|
||||
entries
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user