aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/debug.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-10-27 10:43:30 +0200
committerBad Diode <bd@badd10de.dev>2021-10-27 10:43:30 +0200
commitf0cd7a3cab56a6f8d7b4520aaa168a271a94d6d4 (patch)
tree70a5e81b14f0fe65c959d675909ee3aa471f8354 /src/bytecode/debug.h
parent6eed0aa02c657ae97e18280a6dd9d74c84fd91d4 (diff)
downloadbdl-f0cd7a3cab56a6f8d7b4520aaa168a271a94d6d4.tar.gz
bdl-f0cd7a3cab56a6f8d7b4520aaa168a271a94d6d4.zip
Add initial implementation of locals
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)) {