Skip to content

Commit 8c5ddfe

Browse files
Copilotlevno-710
andcommitted
Fix repeat-until scoping bug in VMify compiler
Co-authored-by: levno-710 <62939318+levno-710@users.noreply.github.com>
1 parent b29f194 commit 8c5ddfe

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/prometheus/compiler/compiler.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,12 +1553,10 @@ function Compiler:compileStatement(statement, funcDepth)
15531553
local innerBlock = self:createBlock();
15541554
local finalBlock = self:createBlock();
15551555
local checkBlock = self:createBlock();
1556-
statement.__start_block = checkBlock;
1556+
statement.__start_block = innerBlock;
15571557
statement.__final_block = finalBlock;
15581558

1559-
local conditionReg = self:compileExpression(statement.condition, funcDepth, 1)[1];
15601559
self:addStatement(self:setRegister(scope, self.POS_REGISTER, Ast.NumberExpression(innerBlock.id)), {self.POS_REGISTER}, {}, false);
1561-
self:freeRegister(conditionReg, false);
15621560

15631561
self:setActiveBlock(innerBlock);
15641562
self:compileBlock(statement.body, funcDepth);

0 commit comments

Comments
 (0)