Fix else if statements #49

This commit is contained in:
2026-06-04 17:57:27 +02:00
parent e571d98cd0
commit d3b54b4114
3 changed files with 4 additions and 4 deletions
+3 -1
View File
@@ -90,12 +90,14 @@ impl GenRust for Statement {
else_branch,
} => {
cg.add("if ");
ctx.expr_ensure_semicolon = false;
initial.condition.gen_rust(ctx, cg);
cg.add(" ");
cg.ensure_brackets_body(ctx, &initial.body);
for else_if_branch in else_if {
cg.add("else if");
cg.add(" else if ");
ctx.expr_ensure_semicolon = false;
else_if_branch.condition.gen_rust(ctx, cg);
cg.add(" ");
cg.ensure_brackets_body(ctx, &else_if_branch.body);
+1 -1
View File
@@ -399,7 +399,7 @@ control_flow = {
statement_branch = { "(" ~ expr ~ ")" ~ statement_body }
else_if = {
else_if = _{
"else" ~ "if" ~ statement_branch
}