From 2fffd9457fb294e1de04e60792ff525ae5065c0b Mon Sep 17 00:00:00 2001 From: mryouse Date: Thu, 8 Jun 2023 21:08:51 -0400 Subject: bugfix: reduce function takes accumulator first --- compiler.d | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler.d b/compiler.d index 9ae009d..1ef18c9 100644 --- a/compiler.d +++ b/compiler.d @@ -443,6 +443,9 @@ class Compiler { this.func.chunk.writeOp(to!ubyte(3), args[0].line); // | [ fn ] [ list ] [ item ] [ acc ] [ fn ] this.func.chunk.writeOp(OpCode.OP_ROTATE_N, args[0].line); this.func.chunk.writeOp(to!ubyte(3), args[0].line); // | [ fn ] [ list ] [ fn ] [ item ] [ acc ] + this.func.chunk.writeOp(OpCode.OP_ROTATE_N, args[0].line); + this.func.chunk.writeOp(to!ubyte(2), args[0].line); // | [ fn ] [ list ] [ fn ] [ acc ] [ item ] + // call the function this.func.chunk.writeOp(OpCode.OP_CALL, args[0].line); -- cgit v1.2.3