diff options
| author | Ben Winston | 2023-05-21 19:55:04 -0400 |
|---|---|---|
| committer | Ben Winston | 2023-05-21 19:55:04 -0400 |
| commit | a26bfccdc52ab50a83b8f8d170c9e1a3be0164a5 (patch) | |
| tree | b12118bebf7e22a29fa4d953ee3a8b7085008612 /vm.d | |
| parent | 618de4c70d8916f64781997f3ae538e3e6109d00 (diff) | |
'or' control statement
Diffstat (limited to 'vm.d')
| -rw-r--r-- | vm.d | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -261,13 +261,23 @@ class VM { case OpCode.OP_JUMP_IF_FALSE: uint offset = readShort(); if (!isBoolean(peekA(0))) { - writeln("if expects a boolean condition"); + writeln("expecting a boolean condition"); return InterpretResult.RUNTIME_ERROR; // TODO error } if (!asBoolean(peekA(0))) { ip += offset; } break; + case OpCode.OP_JUMP_IF_TRUE: + uint offset = readShort(); + if (!isBoolean(peekA(0))) { + writeln("expecting a boolean condition"); + return InterpretResult.RUNTIME_ERROR; // TODO error + } + if (asBoolean(peekA(0))) { + ip += offset; + } + break; default: writeln("unknown opcode to run"); break; |
