From 154228ad21ff7099005ec54c52a63288c30ce68d Mon Sep 17 00:00:00 2001 From: PaddiM8 Date: Sun, 8 Dec 2024 22:05:27 +0100 Subject: [PATCH] vm: Fix ordering of closure parameters --- src/Vm/InstructionGenerator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Vm/InstructionGenerator.cs b/src/Vm/InstructionGenerator.cs index e2d8fe8..11b88c1 100644 --- a/src/Vm/InstructionGenerator.cs +++ b/src/Vm/InstructionGenerator.cs @@ -991,7 +991,7 @@ private void EmitCall(CallExpr expr, bool isMaybeRoot = false, RuntimeFunction? : (byte)variadicStart, Closure = expr.IsReference ? closure - : null + : null, }; EmitBig(InstructionKind.Const, runtimeFunction); @@ -1360,7 +1360,7 @@ private void Visit(ClosureExpr expr, bool isMaybeRoot = false) page.AddLine(expr.StartPosition.Line); _currentPage = page; - foreach (var parameter in expr.Parameters) + foreach (var parameter in expr.Parameters.AsEnumerable().Reverse()) _locals.Push(new Variable(parameter, 0)); var previousBasePointer = _currentBasePointer;