parser: fix type_only fns starting with varargs
parent
564545d20a
commit
30f1c6bad5
|
@ -359,7 +359,7 @@ fn (mut p Parser) fn_args() ([]table.Arg, bool) {
|
|||
mut args := []table.Arg{}
|
||||
mut is_variadic := false
|
||||
// `int, int, string` (no names, just types)
|
||||
types_only := p.tok.kind in [.amp, .and] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) ||
|
||||
types_only := p.tok.kind in [.amp, .and, .ellipsis] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) ||
|
||||
p.peek_tok.kind == .rpar
|
||||
// TODO copy pasta, merge 2 branches
|
||||
if types_only {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Not real external functions, so we won't call them
|
||||
// We just want to make sure they compile
|
||||
|
||||
struct Foo {}
|
||||
|
||||
fn C.a(a string, b int) f32
|
||||
fn C.b(a &voidptr)
|
||||
fn C.c(a string, b ...string) string
|
||||
fn C.d(a ...int)
|
||||
|
||||
fn JS.e(a string, b ...string) int
|
||||
fn JS.f(a &Foo) // TODO: Should this be allowed?
|
||||
|
||||
fn C.g(string, ...int)
|
||||
fn C.h(&int)
|
||||
fn JS.i(...string)
|
Loading…
Reference in New Issue