1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vfmt: fix as var in match expr as var {}

This commit is contained in:
Delyan Angelov 2020-07-04 16:46:46 +03:00
parent fe50bdc164
commit b018381f10

View File

@ -1304,9 +1304,9 @@ pub fn (mut f Fmt) match_expr(it ast.MatchExpr) {
} else if it.cond is ast.SelectorExpr { } else if it.cond is ast.SelectorExpr {
// `x.y as z` // `x.y as z`
// if ident.name != it.var_name && it.var_name != '' { // if ident.name != it.var_name && it.var_name != '' {
if it.var_name != '' {
f.write(' as $it.var_name')
} }
if it.var_name != '' && f.it_name != it.var_name {
f.write(' as $it.var_name')
} }
f.writeln(' {') f.writeln(' {')
f.indent++ f.indent++