You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VMify will fail if there's a repeat until statement that references a local in the until condition that was first defined in the repeat's body
Code to reproduce:
repeatlocalx=5untilx==5-- The condition here should see the `local x = 5` above, as they are actually contained in the same scope
The actual code that parses the repeat until (src/prometheus/parser.lua#L225-L233) is parsing the condition with the return's scope, which should be good, but for some reason something later is breaking because of this, and I have no idea what
The text was updated successfully, but these errors were encountered:
Add a boolean reference in Repeat Statement AST named "hasUpvalue", set it to false if one of the condition variables only refers inside the Repeat loop or true by default; all of this can be done during parsing, and then add a check like this in the compiler.
ifstatement.hasUpvaluethen-- Handle the condition first, which means no local variable refers from body to condition, which is safe.else-- Handle the loop body first (this is where the fix should be applied).end
Add a function in the compiler that safely traverses expressions, so that you can check if there is a local variable inside the Repeat loop that is being used in the condition.
VMify will fail if there's a repeat until statement that references a local in the
until
condition that was first defined in therepeat
's bodyCode to reproduce:
The actual code that parses the repeat until (src/prometheus/parser.lua#L225-L233) is parsing the condition with the return's scope, which should be good, but for some reason something later is breaking because of this, and I have no idea what
The text was updated successfully, but these errors were encountered: