Skip to content
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

[LUA] Fix do while loops on lua #11807

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions src/generators/genlua.ml
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,9 @@ and gen_loop ctx cond do_while e =
println ctx "local _hx_do_first_%i = true;" ctx.break_depth;
let b = open_block ctx in
print ctx "while ";
gen_cond ctx cond;
if do_while then
print ctx " or _hx_do_first_%i" ctx.break_depth;
print ctx "_hx_do_first_%i or " ctx.break_depth;
gen_cond ctx cond;
print ctx " do ";
if do_while then begin
newline ctx;
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/src/unit/issues/Issue11807.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package unit.issues;

class Issue11807 extends Test {
function test() {
var test = null;

do {
test = {type: 5};
} while (test.type != 5);

utest.Assert.pass();
NeeEoo marked this conversation as resolved.
Show resolved Hide resolved
}
}
Loading