diff options
Diffstat (limited to 'tvix/eval/src')
-rw-r--r-- | tvix/eval/src/observer.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tvix/eval/src/observer.rs b/tvix/eval/src/observer.rs index b26d0ff9e352..970a644a3d43 100644 --- a/tvix/eval/src/observer.rs +++ b/tvix/eval/src/observer.rs @@ -150,11 +150,24 @@ impl<W: Write> TracingObserver<W> { } } + fn write_value(&mut self, val: &Value) { + let _ = match val { + // Potentially large types which we only want to print + // the type of (and avoid recursing). + Value::List(l) => write!(&mut self.writer, "list[{}] ", l.len()), + Value::Attrs(a) => write!(&mut self.writer, "attrs[{}] ", a.len()), + Value::Thunk(t) if t.is_evaluated() => Ok(self.write_value(&t.value())), + + // For other value types, defer to the standard value printer. + _ => write!(&mut self.writer, "{} ", val), + }; + } + fn write_stack(&mut self, stack: &[Value]) { let _ = write!(&mut self.writer, "[ "); for val in stack { - let _ = write!(&mut self.writer, "{} ", val); + self.write_value(&val); } let _ = writeln!(&mut self.writer, "]"); |