From cb297bf75e3917813794b57a9089dac72a29a313 Mon Sep 17 00:00:00 2001 From: MCorange Date: Sun, 22 Dec 2024 02:52:39 +0200 Subject: [PATCH] Fixed error when parsing a function with no arguments --- src/parser/stat.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/parser/stat.rs b/src/parser/stat.rs index 55f4c96..a181c15 100644 --- a/src/parser/stat.rs +++ b/src/parser/stat.rs @@ -195,6 +195,9 @@ fn parse_fn_params(tokens: &mut Vec) -> Result)> 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);