diff options
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/eval/src/chunk.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/tvix/eval/src/chunk.rs b/tvix/eval/src/chunk.rs index f1a35a6ce162..95659cffa58f 100644 --- a/tvix/eval/src/chunk.rs +++ b/tvix/eval/src/chunk.rs @@ -155,15 +155,27 @@ impl Chunk { write!(writer, "{:4}\t", line)?; } + let a = |idx| { + match &self[idx] { + Value::Thunk(t) => t.debug_repr(), + Value::Closure(c) => format!("closure({:p})", c.lambda), + Value::Blueprint(b) => format!("blueprint({:p})", b), + val => format!("{}", val), + } + }; + match self[idx] { OpCode::OpConstant(idx) => { - let val_str = match &self[idx] { - Value::Thunk(t) => t.debug_repr(), - Value::Closure(c) => format!("closure({:p})", c.lambda), - val => format!("{}", val), - }; - - writeln!(writer, "OpConstant({}@{})", val_str, idx.0) + writeln!(writer, "OpConstant({}@{})", a(idx), idx.0) + } + OpCode::OpClosure(idx) => { + writeln!(writer, "OpClosure({}@{})", a(idx), idx.0) + } + OpCode::OpThunkClosure(idx) => { + writeln!(writer, "OpThunkClosure({}@{})", a(idx), idx.0) + } + OpCode::OpThunkSuspended(idx) => { + writeln!(writer, "OpThunkSuspended({}@{})", a(idx), idx.0) } op => writeln!(writer, "{:?}", op), }?; |