cgen: fix line number generation on match (#7292)
parent
4d025582c0
commit
fb9db11a00
|
@ -3128,6 +3128,8 @@ fn (mut g Gen) match_expr_sumtype(node ast.MatchExpr, is_expr bool, cond_var str
|
||||||
// TODO too many branches. maybe separate ?: matches
|
// TODO too many branches. maybe separate ?: matches
|
||||||
g.write(' : ')
|
g.write(' : ')
|
||||||
} else {
|
} else {
|
||||||
|
g.writeln('')
|
||||||
|
g.write_v_source_line_info(branch.pos)
|
||||||
g.writeln('else {')
|
g.writeln('else {')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3135,12 +3137,15 @@ fn (mut g Gen) match_expr_sumtype(node ast.MatchExpr, is_expr bool, cond_var str
|
||||||
if is_expr {
|
if is_expr {
|
||||||
g.write(' : ')
|
g.write(' : ')
|
||||||
} else {
|
} else {
|
||||||
|
g.writeln('')
|
||||||
|
g.write_v_source_line_info(branch.pos)
|
||||||
g.write('else ')
|
g.write('else ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if is_expr {
|
if is_expr {
|
||||||
g.write('(')
|
g.write('(')
|
||||||
} else {
|
} else {
|
||||||
|
g.write_v_source_line_info(branch.pos)
|
||||||
g.write('if (')
|
g.write('if (')
|
||||||
}
|
}
|
||||||
g.write(cond_var)
|
g.write(cond_var)
|
||||||
|
@ -3184,6 +3189,8 @@ fn (mut g Gen) match_expr_classic(node ast.MatchExpr, is_expr bool, cond_var str
|
||||||
// TODO too many branches. maybe separate ?: matches
|
// TODO too many branches. maybe separate ?: matches
|
||||||
g.write(' : ')
|
g.write(' : ')
|
||||||
} else {
|
} else {
|
||||||
|
g.writeln('')
|
||||||
|
g.write_v_source_line_info(branch.pos)
|
||||||
g.writeln('else {')
|
g.writeln('else {')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3192,12 +3199,15 @@ fn (mut g Gen) match_expr_classic(node ast.MatchExpr, is_expr bool, cond_var str
|
||||||
if is_expr {
|
if is_expr {
|
||||||
g.write(' : ')
|
g.write(' : ')
|
||||||
} else {
|
} else {
|
||||||
|
g.writeln('')
|
||||||
|
g.write_v_source_line_info(branch.pos)
|
||||||
g.write('else ')
|
g.write('else ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if is_expr {
|
if is_expr {
|
||||||
g.write('(')
|
g.write('(')
|
||||||
} else {
|
} else {
|
||||||
|
g.write_v_source_line_info(branch.pos)
|
||||||
g.write('if (')
|
g.write('if (')
|
||||||
}
|
}
|
||||||
for i, expr in branch.exprs {
|
for i, expr in branch.exprs {
|
||||||
|
|
Loading…
Reference in New Issue