aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode/debug.h')
-rwxr-xr-xsrc/bytecode/debug.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bytecode/debug.h b/src/bytecode/debug.h
index 8c4a2eb..06d48b0 100755
--- a/src/bytecode/debug.h
+++ b/src/bytecode/debug.h
@@ -10,6 +10,7 @@ size_t disassemble_instruction(Chunk *chunk, size_t offset);
10static const char* ops_str[] = { 10static const char* ops_str[] = {
11 // Load/store ops. 11 // Load/store ops.
12 [OP_CONSTANT] = "OP_CONSTANT", 12 [OP_CONSTANT] = "OP_CONSTANT",
13 [OP_LOCAL] = "OP_LOCAL",
13 [OP_DEF] = "OP_DEF", 14 [OP_DEF] = "OP_DEF",
14 [OP_SET] = "OP_SET", 15 [OP_SET] = "OP_SET",
15 [OP_GET] = "OP_GET", 16 [OP_GET] = "OP_GET",
@@ -74,6 +75,11 @@ disassemble_instruction(Chunk *chunk, size_t offset) {
74 } 75 }
75 u8 instruction = chunk->code[offset]; 76 u8 instruction = chunk->code[offset];
76 switch (instruction) { 77 switch (instruction) {
78 case OP_LOCAL: {
79 u8 local = chunk->code[offset + 1];
80 printf("%-16s %4d\n", ops_str[instruction], local);
81 return offset + 2;
82 } break;
77 case OP_CONSTANT: { 83 case OP_CONSTANT: {
78 u8 constant = chunk->code[offset + 1]; 84 u8 constant = chunk->code[offset + 1];
79 printf("%-16s %4d -> ", ops_str[instruction], constant); 85 printf("%-16s %4d -> ", ops_str[instruction], constant);