Skip to content

Commit

Permalink
vm: Fix ordering of closure parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddiM8 committed Dec 8, 2024
1 parent 0884af0 commit 154228a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Vm/InstructionGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 154228a

Please sign in to comment.