chunk: fix disasm on the new const-load op codes

This commit is contained in:
Luna 2019-06-03 00:07:11 -03:00
parent 3936b4a426
commit 922f3c530c
1 changed files with 4 additions and 4 deletions

View File

@ -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;