v2: simplify MatchExpr in vfmt

pull/3937/head
Joe Conigliaro 2020-03-04 22:39:18 +11:00
parent 5872961124
commit 7daf8f8fd0
1 changed files with 8 additions and 10 deletions

View File

@ -443,19 +443,17 @@ fn (f mut Fmt) expr(node ast.Expr) {
f.write(', ') f.write(', ')
} }
} }
f.writeln(' {')
f.stmts(branch.stmts)
f.writeln('}')
} }
// else branch // else branch
else { else {
if (branch.stmts.len == 0) { f.write('else')
f.writeln('else {}') }
} else { if (branch.stmts.len == 0) {
f.writeln('else {') f.writeln(' {}')
f.stmts(branch.stmts) } else {
f.writeln('}') f.writeln(' {')
} f.stmts(branch.stmts)
f.writeln('}')
} }
} }
f.indent-- f.indent--