Skip to content

Commit 6b50040

Browse files
P-E-Pphilberty
authored andcommitted
Parse named variadic parameters
Add ability to parse named variadic parameters in extern c functions. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_named_function_param): Add new parsing ability. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent a5edbe7 commit 6b50040

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gcc/rust/parse/rust-parse-impl.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5970,7 +5970,7 @@ Parser<ManagedTokenSource>::parse_named_function_param ()
59705970
AST::AttrVec outer_attrs = parse_outer_attributes ();
59715971
location_t locus = lexer.peek_token ()->get_locus ();
59725972

5973-
if (lexer.peek_token ()->get_id () == ELLIPSIS)
5973+
if (lexer.peek_token ()->get_id () == ELLIPSIS) // Unnamed variadic
59745974
{
59755975
lexer.skip_token (); // Skip ellipsis
59765976
return AST::NamedFunctionParam (std::move (outer_attrs), locus);
@@ -6002,6 +6002,13 @@ Parser<ManagedTokenSource>::parse_named_function_param ()
60026002
return AST::NamedFunctionParam::create_error ();
60036003
}
60046004

6005+
if (lexer.peek_token ()->get_id () == ELLIPSIS) // Named variadic
6006+
{
6007+
lexer.skip_token (); // Skip ellipsis
6008+
return AST::NamedFunctionParam (std::move (name), std::move (outer_attrs),
6009+
locus);
6010+
}
6011+
60056012
// parse (required) type
60066013
std::unique_ptr<AST::Type> param_type = parse_type ();
60076014
if (param_type == nullptr)

0 commit comments

Comments
 (0)