From 922f3c530c69987e99972073c1ca7932b9262517 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 3 Jun 2019 00:07:11 -0300 Subject: [PATCH] chunk: fix disasm on the new const-load op codes --- src/chunk.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chunk.zig b/src/chunk.zig index abc54af..cbebaf1 100644 --- a/src/chunk.zig +++ b/src/chunk.zig @@ -220,13 +220,13 @@ pub const Chunk = struct { } else if (instruction == OpCode.Pop) { return try simpleInstruction(stdout, "OP_POP", index); } else if (instruction == OpCode.DefineGlobal) { - return try simpleInstruction(stdout, "OP_DEFGLOBAL", index); + return try constantInstruction(stdout, "OP_DEFGLOBAL", self, index); } else if (instruction == OpCode.DefineGlobalLong) { - return try simpleInstruction(stdout, "OP_DEFGLOBAL_LONG", index); + return try constantLongInstruction(stdout, "OP_DEFGLOBAL_LONG", self, index); } else if (instruction == OpCode.GetGlobal) { - return try simpleInstruction(stdout, "OP_GETGLOBAL", index); + return try constantInstruction(stdout, "OP_GETGLOBAL", self, index); } else if (instruction == OpCode.GetGlobalLong) { - return try simpleInstruction(stdout, "OP_GETGLOBAL_LONG", index); + return try constantLongInstruction(stdout, "OP_GETGLOBAL_LONG", self, index); } else { try stdout.print("Unknown opcode: {}\n", instruction); return index + 1;