aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode/debug.h')
-rwxr-xr-xsrc/bytecode/debug.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bytecode/debug.h b/src/bytecode/debug.h
index 06d48b0..54d2cdb 100755
--- a/src/bytecode/debug.h
+++ b/src/bytecode/debug.h
@@ -11,6 +11,8 @@ static 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_LOCAL] = "OP_LOCAL",
14 [OP_DEF_LOCAL] = "OP_DEF_LOCAL",
15 [OP_SET_LOCAL] = "OP_SET_LOCAL",
14 [OP_DEF] = "OP_DEF", 16 [OP_DEF] = "OP_DEF",
15 [OP_SET] = "OP_SET", 17 [OP_SET] = "OP_SET",
16 [OP_GET] = "OP_GET", 18 [OP_GET] = "OP_GET",
@@ -46,7 +48,11 @@ static const char* ops_str[] = {
46 48
47void 49void
48disassemble_chunk(Chunk *chunk) { 50disassemble_chunk(Chunk *chunk) {
49 printf("===== %.*s =====\n", (int)array_size(chunk->name), chunk->name); 51 if (array_size(chunk->name) < 1) {
52 printf("===== main =====\n");
53 } else {
54 printf("===== %.*s =====\n", (int)array_size(chunk->name), chunk->name);
55 }
50 printf("code:\n"); 56 printf("code:\n");
51 size_t offset = 0; 57 size_t offset = 0;
52 while (offset < array_size(chunk->code)) { 58 while (offset < array_size(chunk->code)) {