From 0edabd4a48e9297c9fe8f7d5aad5577bd8d108d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 2 Jan 2023 20:23:43 +0100 Subject: [PATCH] Parser - Fixed loop parsing state in function bodies --- src/parser.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/parser.rs b/src/parser.rs index 36438b7..51d8fd2 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -227,7 +227,12 @@ impl Parser { &TokenType::LeftBrace, &format!("'{{' expected before {} body", kind), )?; - let block = self.parse_block()?; + let block = { + self.loop_state.push(LoopParsingState::None); + let result = self.parse_block(); + self.loop_state.pop(); + result? + }; Ok(ast::StmtNode::FunDecl { name, params,