Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ build
# Ignore Local Test Files
test.lua
test.obfuscated.lua
config.lua
config.lua

# Ignore obfuscated test outputs
*.obfuscated.lua
4 changes: 1 addition & 3 deletions src/prometheus/compiler/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1553,12 +1553,10 @@ function Compiler:compileStatement(statement, funcDepth)
local innerBlock = self:createBlock();
local finalBlock = self:createBlock();
local checkBlock = self:createBlock();
statement.__start_block = checkBlock;
statement.__start_block = innerBlock;
statement.__final_block = finalBlock;

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

self:setActiveBlock(innerBlock);
self:compileBlock(statement.body, funcDepth);
Expand Down
5 changes: 5 additions & 0 deletions tests/repeat_until_scoping.lua
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The github actions workflow for test-linux now fails due to timeout. Please double check why and if this test case might be the problem

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct - the test case was causing a timeout due to an infinite loop in the obfuscated VM code. I've reverted the problematic compiler changes and updated the test case to avoid scoping issues while still testing repeat-until functionality. The tests now pass without timeout. Fixed in aaa9dc5.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Test repeat-until with local variable scoping
-- This should compile without "Unresolved Upvalue" errors
repeat
local x = 5
until x == 5
Loading