difftreelog
fix(evaluator) use context with globals for `into_json`
in: master
1 file changed
crates/jsonnet-evaluator/src/val.rsdiffbeforeafterboth174 })174 })175 }175 }176 pub fn into_json(self, padding: usize) -> Result<String> {176 pub fn into_json(self, padding: usize) -> Result<String> {177 let ctx = Context::new().with_var("__tmp__to_json__".to_owned(), self)?;177 with_state(|s| {178 let ctx = s179 .create_default_context()?180 .with_var("__tmp__to_json__".to_owned(), self)?;178 if let Val::Str(result) = evaluate(181 if let Val::Str(result) = evaluate(179 ctx,182 &ctx,180 &el!(Expr::Apply(183 &el!(Expr::Apply(181 el!(Expr::Index(184 el!(Expr::Index(182 el!(Expr::Var("std".to_owned())),185 el!(Expr::Var("std".to_owned())),193 } else {196 } else {194 unreachable!()197 unreachable!()195 }198 }199 })196 }200 }197}201}198202