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;