about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/chunk.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/chunk.rs')
-rw-r--r--users/tazjin/rlox/src/bytecode/chunk.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/bytecode/chunk.rs b/users/tazjin/rlox/src/bytecode/chunk.rs
index 649aafcfd82c..b2a7c7b6a2c1 100644
--- a/users/tazjin/rlox/src/bytecode/chunk.rs
+++ b/users/tazjin/rlox/src/bytecode/chunk.rs
@@ -84,3 +84,10 @@ pub fn disassemble_instruction(chunk: &Chunk, offset: usize) {
         op => println!("{:?}", op),
     }
 }
+
+#[cfg(feature = "disassemble")]
+pub fn disassemble_chunk(chunk: &Chunk) {
+    for (idx, _) in chunk.code.iter().enumerate() {
+        disassemble_instruction(chunk, idx);
+    }
+}