mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: format if_guard_expr generated c codes (#9290)
This commit is contained in:
parent
e9797c618a
commit
5a6b321656
@ -2859,7 +2859,7 @@ fn (mut g Gen) expr(node ast.Expr) {
|
||||
}
|
||||
if is_gen_or_and_assign_rhs {
|
||||
elem_styp := g.typ(elem_type)
|
||||
g.write('\n$cur_line*($elem_styp*)${tmp_opt}.data')
|
||||
g.write(';\n$cur_line*($elem_styp*)${tmp_opt}.data')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -3703,7 +3703,7 @@ fn (mut g Gen) match_expr_sumtype(node ast.MatchExpr, is_expr bool, cond_var str
|
||||
g.write('(')
|
||||
} else {
|
||||
if j == 0 && sumtype_index == 0 {
|
||||
g.writeln('')
|
||||
g.empty_line = true
|
||||
}
|
||||
g.write_v_source_line_info(branch.pos)
|
||||
g.write('if (')
|
||||
@ -4204,8 +4204,6 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
||||
is_guard = true
|
||||
guard_idx = i
|
||||
guard_vars = []string{len: node.branches.len}
|
||||
g.writeln(';')
|
||||
g.writeln('{ /* if guard */ ')
|
||||
}
|
||||
if cond.expr !is ast.IndexExpr && cond.expr !is ast.PrefixExpr {
|
||||
var_name := g.new_tmp_var()
|
||||
@ -4285,9 +4283,6 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
||||
g.stmts(branch.stmts)
|
||||
}
|
||||
}
|
||||
if is_guard {
|
||||
g.write('}')
|
||||
}
|
||||
g.writeln('}')
|
||||
if needs_tmp_var {
|
||||
g.empty_line = false
|
||||
|
Loading…
Reference in New Issue
Block a user