mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: cleanup in if_expr() (#13754)
This commit is contained in:
parent
7a4715288c
commit
136f39a2d4
@ -115,9 +115,7 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
|||||||
cvar_name := guard_vars[guard_idx]
|
cvar_name := guard_vars[guard_idx]
|
||||||
g.writeln('\tIError err = ${cvar_name}.err;')
|
g.writeln('\tIError err = ${cvar_name}.err;')
|
||||||
}
|
}
|
||||||
} else {
|
} else if branch.cond is ast.IfGuardExpr {
|
||||||
match branch.cond {
|
|
||||||
ast.IfGuardExpr {
|
|
||||||
mut var_name := guard_vars[i]
|
mut var_name := guard_vars[i]
|
||||||
mut short_opt := false
|
mut short_opt := false
|
||||||
if var_name == '' {
|
if var_name == '' {
|
||||||
@ -176,8 +174,7 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mut no_needs_par := false
|
mut no_needs_par := false
|
||||||
if branch.cond is ast.InfixExpr {
|
if branch.cond is ast.InfixExpr {
|
||||||
if branch.cond.op == .key_in && branch.cond.left !is ast.InfixExpr
|
if branch.cond.op == .key_in && branch.cond.left !is ast.InfixExpr
|
||||||
@ -197,8 +194,6 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
|||||||
g.writeln(') {')
|
g.writeln(') {')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if needs_tmp_var {
|
if needs_tmp_var {
|
||||||
if node.is_expr && g.table.sym(node.typ).kind == .sum_type {
|
if node.is_expr && g.table.sym(node.typ).kind == .sum_type {
|
||||||
g.expected_cast_type = node.typ
|
g.expected_cast_type = node.typ
|
||||||
|
Loading…
x
Reference in New Issue
Block a user