cgen: minor cleanup of struct.v (#13661)
parent
22fda7c3dd
commit
6380b9eb15
|
@ -4359,10 +4359,6 @@ fn (mut g Gen) global_decl(node ast.GlobalDecl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut g Gen) go_back_out(n int) {
|
|
||||||
g.out.go_back(n)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn (mut g Gen) assoc(node ast.Assoc) {
|
fn (mut g Gen) assoc(node ast.Assoc) {
|
||||||
g.writeln('// assoc')
|
g.writeln('// assoc')
|
||||||
if node.typ == 0 {
|
if node.typ == 0 {
|
||||||
|
|
|
@ -5,16 +5,14 @@ module c
|
||||||
|
|
||||||
import v.ast
|
import v.ast
|
||||||
|
|
||||||
const (
|
const skip_struct_init = ['struct stat', 'struct addrinfo']
|
||||||
skip_struct_init = ['struct stat', 'struct addrinfo']
|
|
||||||
)
|
|
||||||
|
|
||||||
fn (mut g Gen) struct_init(node ast.StructInit) {
|
fn (mut g Gen) struct_init(node ast.StructInit) {
|
||||||
styp := g.typ(node.typ)
|
styp := g.typ(node.typ)
|
||||||
mut shared_styp := '' // only needed for shared x := St{...
|
mut shared_styp := '' // only needed for shared x := St{...
|
||||||
if styp in c.skip_struct_init {
|
if styp in c.skip_struct_init {
|
||||||
// needed for c++ compilers
|
// needed for c++ compilers
|
||||||
g.go_back_out(3)
|
g.out.go_back(3)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mut sym := g.table.final_sym(g.unwrap_generic(node.typ))
|
mut sym := g.table.final_sym(g.unwrap_generic(node.typ))
|
||||||
|
|
Loading…
Reference in New Issue