git.delta.rocks / jrsonnet / refs/commits / 205150053175

difftreelog

refactor! rename with_super to extend_from

Yaroslav Bolyukin2021-02-20parent: #ff10378.patch.diff
in: master

2 files changed

modifiedcrates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth
92 (Val::Str(s), o) => Val::Str(format!("{}{}", s, o.clone().to_string()?).into()),92 (Val::Str(s), o) => Val::Str(format!("{}{}", s, o.clone().to_string()?).into()),
93 (o, Val::Str(s)) => Val::Str(format!("{}{}", o.clone().to_string()?, s).into()),93 (o, Val::Str(s)) => Val::Str(format!("{}{}", o.clone().to_string()?, s).into()),
9494
95 (Val::Obj(v1), Val::Obj(v2)) => Val::Obj(v2.with_super(v1.clone())),95 (Val::Obj(v1), Val::Obj(v2)) => Val::Obj(v2.extend_from(v1.clone())),
96 (Val::Arr(a), Val::Arr(b)) => {96 (Val::Arr(a), Val::Arr(b)) => {
97 let mut out = Vec::with_capacity(a.len() + b.len());97 let mut out = Vec::with_capacity(a.len() + b.len());
98 out.extend(a.iter_lazy());98 out.extend(a.iter_lazy());
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -62,10 +62,10 @@
 	pub fn new_empty() -> Self {
 		Self::new(None, Rc::new(FxHashMap::default()))
 	}
-	pub fn with_super(&self, super_obj: Self) -> Self {
+	pub fn extend_from(&self, super_obj: Self) -> Self {
 		match &self.0.super_obj {
 			None => Self::new(Some(super_obj), self.0.this_entries.clone()),
-			Some(v) => Self::new(Some(v.with_super(super_obj)), self.0.this_entries.clone()),
+			Some(v) => Self::new(Some(v.extend_from(super_obj)), self.0.this_entries.clone()),
 		}
 	}
 	pub fn with_this(&self, this_obj: Self) -> Self {