compiler: variadic fn - fix unexpected token `,` error from #2433 (#2468)

* merge master
* fix unexpected token
pull/2475/head
joe-conigliaro 2019-10-21 23:30:34 +11:00 committed by GitHub
parent eef73eea22
commit 7680d9a23c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -1051,11 +1051,8 @@ fn (p mut Parser) fn_call_args(f mut Fn) {
if p.tok != .comma && !is_variadic {
p.error('wrong number of arguments for $i,$arg.name fn `$f.name`: expected $f.args.len, but got less')
}
if p.tok == .comma {
p.fgen(', ')
}
if !is_variadic {
p.next()
if p.tok == .comma && (!is_variadic || (is_variadic && i < f.args.len-2 )) {
p.check(.comma)
p.gen(',')
}
}