Parser - Fixed loop parsing state in function bodies

This commit is contained in:
Emmanuel BENOîT 2023-01-02 20:23:43 +01:00
parent 549e93e9a9
commit 0edabd4a48

View file

@ -227,7 +227,12 @@ impl Parser {
&TokenType::LeftBrace, &TokenType::LeftBrace,
&format!("'{{' expected before {} body", kind), &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 { Ok(ast::StmtNode::FunDecl {
name, name,
params, params,