diff options
| author | Ben Winston | 2023-05-21 23:50:04 -0400 |
|---|---|---|
| committer | Ben Winston | 2023-05-21 23:50:04 -0400 |
| commit | 03b4987afc5e32ec560fac6f74c153d592f75259 (patch) | |
| tree | ca29375c89260d7678e7b173bd663327170533f5 /dbg.d | |
| parent | 8e1f84b1369909745859777d07a5e8e74b5df334 (diff) | |
functionsgit add *.d!
Diffstat (limited to 'dbg.d')
| -rw-r--r-- | dbg.d | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -75,12 +75,14 @@ string printableValue(Value val) { } else { return "false"; } + case ValueType.OBJ: + return printableFunction(val.as.obj); default: return "! unknown value type !"; } } -string printableFunction(Function func) { +string printableFunction(Obj func) { return format("%s", func); } @@ -147,6 +149,8 @@ int disassemble(Chunk chunk, int offset) { return constantInstruction("OP_CONSTANT", chunk, offset); case OpCode.OP_DEF_GLOBAL: return constantInstruction("OP_DEF_GLOBAL", chunk, offset); + case OpCode.OP_GET_GLOBAL: + return constantInstruction("OP_GET_GLOBAL", chunk, offset); case OpCode.OP_NEGATE: return simpleInstruction("OP_NEGATE", offset); case OpCode.OP_POP: @@ -165,6 +169,8 @@ int disassemble(Chunk chunk, int offset) { return jumpInstruction("OP_JUMP_IF_FALSE", 1, chunk, offset); case OpCode.OP_JUMP_IF_TRUE: return jumpInstruction("OP_JUMP_IF_TRUE", 1, chunk, offset); + case OpCode.OP_CALL: + return byteInstruction("OP_CALL", chunk, offset); default: writeln("unknown opcode?"); |
