v.gen.c: reduce slightly the generated C lines with -skip-unused (3940 -> 3699 for hello_world.v)
parent
a706215e52
commit
820fe626e7
|
@ -1264,7 +1264,9 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast.TypeDecl {
|
ast.TypeDecl {
|
||||||
g.writeln('// TypeDecl')
|
if !g.pref.skip_unused {
|
||||||
|
g.writeln('// TypeDecl')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !g.skip_stmt_pos { // && g.stmt_path_pos.len > 0 {
|
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) {
|
fn (mut g Gen) gen_attrs(attrs []ast.Attr) {
|
||||||
|
if g.pref.skip_unused {
|
||||||
|
return
|
||||||
|
}
|
||||||
for attr in attrs {
|
for attr in attrs {
|
||||||
g.writeln('// Attr: [$attr.name]')
|
g.writeln('// Attr: [$attr.name]')
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,8 +86,10 @@ fn (mut g Gen) process_fn_decl(node ast.FnDecl) {
|
||||||
if skip {
|
if skip {
|
||||||
g.out.go_back_to(pos)
|
g.out.go_back_to(pos)
|
||||||
}
|
}
|
||||||
if node.language != .c {
|
if !g.pref.skip_unused {
|
||||||
g.writeln('')
|
if node.language != .c {
|
||||||
|
g.writeln('')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue