git.delta.rocks / jrsonnet / refs/commits / 494be6551f3b

difftreelog

feat support arbitrary values in std.trace

Yaroslav Bolyukin2023-08-06parent: #cb76562.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
55pub fn builtin_trace(55pub fn builtin_trace(
56 this: &builtin_trace,56 this: &builtin_trace,
57 loc: CallLocation,57 loc: CallLocation,
58 str: IStr,58 str: Val,
59 rest: Thunk<Val>,59 rest: Thunk<Val>,
60) -> Result<Val> {60) -> Result<Val> {
61 this.settings.borrow().trace_printer.print_trace(loc, str);61 this.settings.borrow().trace_printer.print_trace(
62 loc,
63 match str {
64 Val::Str(s) => s.into_flat(),
65 Val::Func(f) => format!("{f:?}").into(),
66 v => v
67 .manifest(JsonFormat::std_to_json(
68 String::from(" "),
69 "\n",
70 ": ",
71 #[cfg(feature = "exp-preserve-order")]
72 true,
73 ))?
74 .into(),
75 },
76 );
62 rest.evaluate()77 rest.evaluate()
63}78}