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

cgen: minor cleanup of struct.v (#13661)

This commit is contained in:
yuyi 2022-03-05 23:19:20 +08:00 committed by GitHub
parent 22fda7c3dd
commit 6380b9eb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -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) {
g.writeln('// assoc')
if node.typ == 0 {

View File

@ -5,16 +5,14 @@ module c
import v.ast
const (
skip_struct_init = ['struct stat', 'struct addrinfo']
)
const skip_struct_init = ['struct stat', 'struct addrinfo']
fn (mut g Gen) struct_init(node ast.StructInit) {
styp := g.typ(node.typ)
mut shared_styp := '' // only needed for shared x := St{...
if styp in c.skip_struct_init {
// needed for c++ compilers
g.go_back_out(3)
g.out.go_back(3)
return
}
mut sym := g.table.final_sym(g.unwrap_generic(node.typ))