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

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

* merge master
* fix unexpected token
This commit is contained in:
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

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(',')
}
}