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

only register initial varg struct on first pass (#2404)

This commit is contained in:
joe-conigliaro 2019-10-18 19:28:14 +11:00 committed by GitHub
parent 368e8e85a8
commit 689003454b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -737,8 +737,10 @@ fn (p mut Parser) fn_args(f mut Fn) {
}
t := p.get_type()
// register varg struct, incase function is never called
vargs_struct := p.fn_register_vargs_stuct(f, t, []string)
p.cgen.typedefs << 'typedef struct $vargs_struct $vargs_struct;\n'
if p.first_pass() {
vargs_struct := p.fn_register_vargs_stuct(f, t, []string)
p.cgen.typedefs << 'typedef struct $vargs_struct $vargs_struct;\n'
}
typ = '...$t'
} else {
typ = p.get_type()