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
I encountered this bug while compiling to JS real-life Lua. This minimal code triggers it:
function a() end
while true do
break
end
This gets compiled to:
G.str['a'] = (function () {
var tmp;
return [];
})
while (true) (function() {
return;
})();
Notice the immediately-invoked function expression (IIFE) inside the while loop in the generated JS code. The Lua break statement is compiled into a return call but all it does is leave the function body, not the loop. So the loop, which should exit immediately, runs forever (and locks up the browser).
The Lua function declaration function a() end at the top is required to trigger the insertion of the IIFE and thus the bug.
The text was updated successfully, but these errors were encountered:
I'm not familiar with Jison so I'd rather not try and fix it myself as I'm likely to botch something else accidentally.
The while statement should probably be generated inside the generated IIFE. There are questions about how that might interact with the condition scoping though? Not sure.
I encountered this bug while compiling to JS real-life Lua. This minimal code triggers it:
This gets compiled to:
Notice the immediately-invoked function expression (IIFE) inside the while loop in the generated JS code. The Lua
break
statement is compiled into areturn
call but all it does is leave the function body, not the loop. So the loop, which should exit immediately, runs forever (and locks up the browser).The Lua function declaration
function a() end
at the top is required to trigger the insertion of the IIFE and thus the bug.The text was updated successfully, but these errors were encountered: