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

checker/fmt/cgen: fun vfmt on changes from previous commit

This commit is contained in:
Joe Conigliaro 2020-03-21 00:46:00 +11:00
parent a331abf675
commit 15d4b5fcdb
3 changed files with 8 additions and 14 deletions

View File

@ -406,9 +406,6 @@ fn (f mut Fmt) expr(node ast.Expr) {
f.write(' ')
}
}
// if !single_line {
// f.writeln('')
// }
f.write('}')
f.single_line_if = false
}

View File

@ -1176,7 +1176,7 @@ fn (g mut Gen) if_expr(node ast.IfExpr) {
}
// one line ?:
// TODO clean this up once `is` is supported
// TODO: make sure only one stmt in eac branch
// TODO: make sure only one stmt in each branch
if node.is_expr && node.branches.len >= 2 && node.has_else && type_sym.kind != .void {
g.inside_ternary = true
for i, branch in node.branches {
@ -1211,7 +1211,6 @@ fn (g mut Gen) if_expr(node ast.IfExpr) {
g.writeln(') {')
}
}
}
else if i < node.branches.len - 1 || !node.has_else {
g.writeln('} else if (')
@ -1229,9 +1228,7 @@ fn (g mut Gen) if_expr(node ast.IfExpr) {
// Assign ret value
// if i == node.stmts.len - 1 && type_sym.kind != .void {}
// g.writeln('$tmp =')
//
g.stmts(branch.stmts)
// g.writeln('')
}
if is_guard {
g.write('}')