Parsed - Fixed class parser

This commit is contained in:
Emmanuel BENOîT 2023-01-08 10:58:02 +01:00
parent af68acde70
commit 7306fa0cfa

View file

@ -228,7 +228,7 @@ impl Parser {
// Read the body // Read the body
self.consume(&TokenType::LeftBrace, "'{' expected")?; self.consume(&TokenType::LeftBrace, "'{' expected")?;
let mut methods = Vec::new(); let mut methods = Vec::new();
while !self.check(&TokenType::LeftBrace) && !self.is_at_end() { while !self.check(&TokenType::RightBrace) && !self.is_at_end() {
match self.parse_function(FunctionKind::Method)? { match self.parse_function(FunctionKind::Method)? {
StmtNode::FunDecl(d) => methods.push(d), StmtNode::FunDecl(d) => methods.push(d),
_ => panic!("Function declaration expected"), _ => panic!("Function declaration expected"),