Improve shared value treatment.

This commit is contained in:
Stephen Chung
2020-08-08 16:24:10 +08:00
parent f016655414
commit 5a1a141ce3
6 changed files with 100 additions and 69 deletions

View File

@@ -925,11 +925,11 @@ impl Engine {
self.inc_operations(state)
.map_err(|err| err.new_position(pos))?;
// Turn it into a method call only if the object is not shared
args = if target.is_shared() {
arg_values.insert(0, target.clone().clone_inner_data().unwrap());
arg_values.insert(0, target.get_inner_clone());
arg_values.iter_mut().collect()
} else {
// Turn it into a method call only if the object is not shared
is_ref = true;
once(target).chain(arg_values.iter_mut()).collect()
};