mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Merge #926
926: allow vararg functions r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
dc8bcc1e42
3 changed files with 56 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
extern "C" { fn printf(format: *const i8, ...) -> i32; }
|
|
@ -0,0 +1,49 @@
|
|||
SOURCE_FILE@[0; 57)
|
||||
EXTERN_BLOCK@[0; 56)
|
||||
ABI@[0; 10)
|
||||
EXTERN_KW@[0; 6)
|
||||
WHITESPACE@[6; 7)
|
||||
STRING@[7; 10)
|
||||
WHITESPACE@[10; 11)
|
||||
EXTERN_ITEM_LIST@[11; 56)
|
||||
L_CURLY@[11; 12)
|
||||
WHITESPACE@[12; 13)
|
||||
FN_DEF@[13; 54)
|
||||
FN_KW@[13; 15)
|
||||
WHITESPACE@[15; 16)
|
||||
NAME@[16; 22)
|
||||
IDENT@[16; 22) "printf"
|
||||
PARAM_LIST@[22; 46)
|
||||
L_PAREN@[22; 23)
|
||||
PARAM@[23; 40)
|
||||
BIND_PAT@[23; 29)
|
||||
NAME@[23; 29)
|
||||
IDENT@[23; 29) "format"
|
||||
COLON@[29; 30)
|
||||
WHITESPACE@[30; 31)
|
||||
POINTER_TYPE@[31; 40)
|
||||
STAR@[31; 32)
|
||||
CONST_KW@[32; 37)
|
||||
WHITESPACE@[37; 38)
|
||||
PATH_TYPE@[38; 40)
|
||||
PATH@[38; 40)
|
||||
PATH_SEGMENT@[38; 40)
|
||||
NAME_REF@[38; 40)
|
||||
IDENT@[38; 40) "i8"
|
||||
COMMA@[40; 41)
|
||||
WHITESPACE@[41; 42)
|
||||
DOTDOTDOT@[42; 45)
|
||||
R_PAREN@[45; 46)
|
||||
WHITESPACE@[46; 47)
|
||||
RET_TYPE@[47; 53)
|
||||
THIN_ARROW@[47; 49)
|
||||
WHITESPACE@[49; 50)
|
||||
PATH_TYPE@[50; 53)
|
||||
PATH@[50; 53)
|
||||
PATH_SEGMENT@[50; 53)
|
||||
NAME_REF@[50; 53)
|
||||
IDENT@[50; 53) "i32"
|
||||
SEMI@[53; 54)
|
||||
WHITESPACE@[54; 55)
|
||||
R_CURLY@[55; 56)
|
||||
WHITESPACE@[56; 57)
|
Loading…
Reference in a new issue