Skip to content

TSTL generates unrechable code when converts 'continue' statement on Lua 5.1 #1638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
inklesspen1rus opened this issue Jun 2, 2025 · 1 comment · Fixed by #1640
Closed
Labels
bug scope: transformation Transformation of TS to Lua

Comments

@inklesspen1rus
Copy link

Here's example of TS code:

while (true) continue;

Here's generated code:

--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
while true do
    do
        local __continue2
        repeat
            __continue2 = true
            break
            __continue2 = true
        until true
        if not __continue2 then
            break
        end
    end
end

TSTL generated unneeded __continue2 = true after break statement.

@inklesspen1rus
Copy link
Author

Seems a bit funny, because darklua can't handle this 😄
seaofvoices/darklua#271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug scope: transformation Transformation of TS to Lua
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants