allow vararg functions

This commit is contained in:
Aleksey Kladov 2019-03-04 14:34:59 +03:00
parent 5197e16648
commit a99b1db49f
3 changed files with 56 additions and 1 deletions

View file

@ -43,7 +43,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
if flavor.type_required() {
opt_self_param(p);
}
while !p.at(EOF) && !p.at(ket) {
while !p.at(EOF) && !p.at(ket) && !(flavor == Flavor::Normal && p.at(DOTDOTDOT)) {
if !p.at_ts(VALUE_PARAMETER_FIRST) {
p.error("expected value parameter");
break;
@ -53,6 +53,11 @@ fn list_(p: &mut Parser, flavor: Flavor) {
p.expect(COMMA);
}
}
// test param_list_vararg
// extern "C" { fn printf(format: *const i8, ...) -> i32; }
if flavor == Flavor::Normal {
p.eat(DOTDOTDOT);
}
p.expect(ket);
m.complete(p, PARAM_LIST);
}