mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: minor optimization in if_expr() (#15748)
This commit is contained in:
parent
a3d6a9349d
commit
840370f345
@ -269,13 +269,12 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
||||
g.writeln('\t$base_type $left_var_name = *($base_type*)${var_name}.data;')
|
||||
}
|
||||
} else if branch.cond.vars.len > 1 {
|
||||
for vi, var in branch.cond.vars {
|
||||
left_var_name := c_name(var.name)
|
||||
sym := g.table.sym(branch.cond.expr_type)
|
||||
if sym.kind == .multi_return {
|
||||
mr_info := sym.info as ast.MultiReturn
|
||||
if mr_info.types.len == branch.cond.vars.len {
|
||||
var_typ := g.typ(mr_info.types[vi])
|
||||
sym := g.table.sym(branch.cond.expr_type)
|
||||
if sym.info is ast.MultiReturn {
|
||||
if sym.info.types.len == branch.cond.vars.len {
|
||||
for vi, var in branch.cond.vars {
|
||||
var_typ := g.typ(sym.info.types[vi])
|
||||
left_var_name := c_name(var.name)
|
||||
if is_auto_heap {
|
||||
g.writeln('\t$var_typ* $left_var_name = (HEAP($base_type, *($base_type*)${var_name}.data).arg$vi);')
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user