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

cgen: remove redundant spaces in generated C

This commit is contained in:
krischerven 2020-04-08 10:52:07 -04:00 committed by GitHub
parent 5247d5924e
commit bcb9d90abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -502,7 +502,7 @@ fn (g mut Gen) for_in(it ast.ForInStmt) {
g.expr(it.cond) g.expr(it.cond)
g.write('; $i < ') g.write('; $i < ')
g.expr(it.high) g.expr(it.high)
g.writeln('; $i++) { ') g.writeln('; $i++) {')
g.writeln('\tint $it.val_var = $i;') g.writeln('\tint $it.val_var = $i;')
g.stmts(it.stmts) g.stmts(it.stmts)
g.writeln('}') g.writeln('}')
@ -829,7 +829,7 @@ fn (g mut Gen) gen_fn_decl(it ast.FnDecl) {
g.writeln(');') g.writeln(');')
return return
} }
g.writeln(') { ') g.writeln(') {')
if !is_main { if !is_main {
g.definitions.writeln(');') g.definitions.writeln(');')
} }
@ -972,7 +972,7 @@ fn (g mut Gen) expr(node ast.Expr) {
} else { } else {
len := it.exprs.len len := it.exprs.len
g.write('new_array_from_c_array($len, $len, sizeof($elem_type_str), ') g.write('new_array_from_c_array($len, $len, sizeof($elem_type_str), ')
g.writeln('($elem_type_str[$len]){\t') g.write('($elem_type_str[$len]){\n\t\t')
for expr in it.exprs { for expr in it.exprs {
g.expr(expr) g.expr(expr)
g.write(', ') g.write(', ')