diff options
| author | mryouse | 2023-05-26 21:04:49 +0000 |
|---|---|---|
| committer | mryouse | 2023-05-26 21:04:49 +0000 |
| commit | a043f552ddca8d890b14bcddf555472ef69e9014 (patch) | |
| tree | e4dbc495867791aff6c5d9129a717f6a0f55578d /vm.d | |
| parent | b57c1630da58d55dbb7855d9de76f776600038ea (diff) | |
bytecode compilation of map()
Diffstat (limited to 'vm.d')
| -rw-r--r-- | vm.d | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -311,7 +311,7 @@ class VM { // pop the next n-1 values Value[] inner; - for (int i = 0; i < n - 1; i++) { + for (int i = 0; i < (n - 1); i++) { inner ~= this.popA(); } @@ -319,7 +319,7 @@ class VM { this.pushA(top); // push the other values (preserve order) - for (int i = n - 1; i >= 0; i--) { + for (int i = (n - 2); i >= 0; i--) { this.pushA(inner[i]); } break; @@ -568,13 +568,16 @@ class VM { this.popA(); // throw this one away this.pushA(val); break; - + case OpCode.OP_JUMP_TO: + uint addr = this.readShort(); + //this.current.ip -= offset; + this.current.ip = to!ubyte(addr); + break; case OpCode.OP_JUMP: uint offset = this.readShort(); //ip += offset; this.current.ip += offset; break; - case OpCode.OP_JUMP_IF_FALSE: uint offset = this.readShort(); if (!isBoolean(this.peekA(0))) { |
