v.gen.c: reduce slightly the generated C lines with -skip-unused (3940 -> 3699 for hello_world.v)

pull/9653/head
Delyan Angelov 2021-04-09 17:56:36 +03:00
parent a706215e52
commit 820fe626e7
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 10 additions and 3 deletions

View File

@ -1264,7 +1264,9 @@ fn (mut g Gen) stmt(node ast.Stmt) {
}
}
ast.TypeDecl {
g.writeln('// TypeDecl')
if !g.pref.skip_unused {
g.writeln('// TypeDecl')
}
}
}
if !g.skip_stmt_pos { // && g.stmt_path_pos.len > 0 {
@ -1793,6 +1795,9 @@ fn ctoslit(s string) string {
}
fn (mut g Gen) gen_attrs(attrs []ast.Attr) {
if g.pref.skip_unused {
return
}
for attr in attrs {
g.writeln('// Attr: [$attr.name]')
}

View File

@ -86,8 +86,10 @@ fn (mut g Gen) process_fn_decl(node ast.FnDecl) {
if skip {
g.out.go_back_to(pos)
}
if node.language != .c {
g.writeln('')
if !g.pref.skip_unused {
if node.language != .c {
g.writeln('')
}
}
}