aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormryouse2023-06-08 21:08:51 -0400
committermryouse2023-06-08 21:08:51 -0400
commit2fffd9457fb294e1de04e60792ff525ae5065c0b (patch)
treed0c78b6b68df5a81077d58382f2f302bbb30a761
parent90cb7bac9bab65a3816cf9e04f247c04fc445bfe (diff)
bugfix: reduce function takes accumulator first
-rw-r--r--compiler.d3
1 files changed, 3 insertions, 0 deletions
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);