summaryrefslogtreecommitdiff
path: root/src/parse/paths.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse/paths.cpp')
-rw-r--r--src/parse/paths.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/parse/paths.cpp b/src/parse/paths.cpp
index 2a2437ca..cb704f85 100644
--- a/src/parse/paths.cpp
+++ b/src/parse/paths.cpp
@@ -142,18 +142,14 @@ AST::Path Parse_Path(TokenStream& lex, bool is_abs, eParsePathGenericMode generi
auto ps = lex.start_span();
DEBUG("Fn() hack");
::std::vector<TypeRef> args;
- if( GET_TOK(tok, lex) == TOK_PAREN_CLOSE )
- {
- // Empty list
- }
- else
- {
- PUTBACK(tok, lex);
- do {
- // TODO: Trailing commas
- args.push_back( Parse_Type(lex) );
- } while( GET_TOK(tok, lex) == TOK_COMMA );
- }
+ do {
+ // Trailing comma or empty list support
+ if( lex.lookahead(0) == TOK_PAREN_CLOSE ) {
+ GET_TOK(tok, lex);
+ break;
+ }
+ args.push_back( Parse_Type(lex) );
+ } while( GET_TOK(tok, lex) == TOK_COMMA );
CHECK_TOK(tok, TOK_PAREN_CLOSE);
TypeRef ret_type = TypeRef( TypeRef::TagUnit(), Span(tok.get_pos()) );