mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
parent
6f629d1a6a
commit
05885059bd
@ -5051,12 +5051,27 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
mut no_needs_par := false
|
||||
if branch.cond is ast.InfixExpr {
|
||||
if branch.cond.op == .key_in && branch.cond.left !is ast.InfixExpr
|
||||
&& branch.cond.right is ast.ArrayInit {
|
||||
no_needs_par = true
|
||||
}
|
||||
}
|
||||
if no_needs_par {
|
||||
g.write('if ')
|
||||
} else {
|
||||
g.write('if (')
|
||||
}
|
||||
g.expr(branch.cond)
|
||||
if no_needs_par {
|
||||
g.writeln(' {')
|
||||
} else {
|
||||
g.writeln(') {')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if needs_tmp_var {
|
||||
g.stmts_with_tmp_var(branch.stmts, tmp)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user