Fixed error when parsing a function with no arguments

This commit is contained in:
Gvidas Juknevičius 2024-12-22 02:52:39 +02:00
parent d5f02cf1d5
commit cb297bf75e
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB

View File

@ -195,6 +195,9 @@ fn parse_fn_params(tokens: &mut Vec<Token>) -> Result<Vec<(Ident, LocBox<Type>)>
let mut args = Vec::new();
utils::check_consume_or_err(tokens, TokenType::Delim(Delimiter::ParenL), "")?;
while !tokens.is_empty() {
if let Some(_) = utils::check(tokens, TokenType::Delim(Delimiter::ParenR)) {
break;
}
let name = utils::check_consume_or_err(tokens, TokenType::ident(""), "")?;
utils::check_consume_or_err(tokens, TokenType::Punct(Punctuation::Colon), "")?;
//dbg!(&name);