diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-26 13:34:44 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-26 13:34:44 +0200 |
commit | 583e0b431a6581206368968d56287a858d53b10a (patch) | |
tree | 1259b57f9890184f2a0ffbd76471d0f4f65372ac /src/bytecode/debug.h | |
parent | 19fb6b2d97a970f94854cd17a58639b72d35c052 (diff) | |
download | bdl-583e0b431a6581206368968d56287a858d53b10a.tar.gz bdl-583e0b431a6581206368968d56287a858d53b10a.zip |
Add initial parameter support for function calls
Diffstat (limited to 'src/bytecode/debug.h')
-rwxr-xr-x | src/bytecode/debug.h | 6 |
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); | |||
10 | static const char* ops_str[] = { | 10 | 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_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); |