From 583e0b431a6581206368968d56287a858d53b10a Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 26 Oct 2021 13:34:44 +0200 Subject: Add initial parameter support for function calls --- src/bytecode/debug.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bytecode/debug.h') 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); static const char* ops_str[] = { // Load/store ops. [OP_CONSTANT] = "OP_CONSTANT", + [OP_LOCAL] = "OP_LOCAL", [OP_DEF] = "OP_DEF", [OP_SET] = "OP_SET", [OP_GET] = "OP_GET", @@ -74,6 +75,11 @@ disassemble_instruction(Chunk *chunk, size_t offset) { } u8 instruction = chunk->code[offset]; switch (instruction) { + case OP_LOCAL: { + u8 local = chunk->code[offset + 1]; + printf("%-16s %4d\n", ops_str[instruction], local); + return offset + 2; + } break; case OP_CONSTANT: { u8 constant = chunk->code[offset + 1]; printf("%-16s %4d -> ", ops_str[instruction], constant); -- cgit v1.2.1