git.delta.rocks / jrsonnet / refs/commits / 51b072d6f8c5

difftreelog

fix do not open assertion with this as api

Yaroslav Bolyukin2021-05-23parent: #59c4f48.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
221 .evaluate()221 .evaluate()
222 }222 }
223
223 fn run_assertions(&self, real_this: &Self) -> Result<()> {224 fn run_assertions_raw(&self, real_this: &Self) -> Result<()> {
224 if self.0.assertions_ran.borrow().contains(&real_this) {225 if self.0.assertions_ran.borrow_mut().insert(real_this.clone()) {
225 // Assertions already ran
226 } else {
227 self.0.assertions_ran.borrow_mut().insert(real_this.clone());
228 for assertion in self.0.assertions.iter() {226 for assertion in self.0.assertions.iter() {
229 println!("{:#?}", assertion);
230 if let Err(e) = evaluate_assert(self.0.context.clone().with_this_super(real_this.clone(), self.0.super_obj.clone()), &assertion) {227 if let Err(e) = evaluate_assert(
228 self.0
229 .context
230 .clone()
231 .with_this_super(real_this.clone(), self.0.super_obj.clone()),
232 assertion,
233 ) {
231 self.0.assertions_ran.borrow_mut().remove(&real_this);234 self.0.assertions_ran.borrow_mut().remove(real_this);
232 return Err(e)235 return Err(e);
233 }236 }
234 }237 }
235 if let Some(super_obj) = &self.0.super_obj {238 if let Some(super_obj) = &self.0.super_obj {
236 super_obj.run_assertions(&real_this)?;239 super_obj.run_assertions_raw(real_this)?;
237 }240 }
238 }241 }
239 Ok(())242 Ok(())
240 }243 }
244 pub fn run_assertions(&self) -> Result<()> {
245 self.run_assertions_raw(self)
246 }
241247
242 pub fn ptr_eq(a: &Self, b: &Self) -> bool {248 pub fn ptr_eq(a: &Self, b: &Self) -> bool {
243 Rc::ptr_eq(&a.0, &b.0)249 Rc::ptr_eq(&a.0, &b.0)