Parser - Accomodate AST class structure changes

This commit is contained in:
Emmanuel BENOîT 2023-01-14 13:20:50 +01:00
parent 366ba6e307
commit 71a58c12a2

View file

@ -2,8 +2,8 @@ use std::collections::HashSet;
use crate::{
ast::{
BinaryExpr, ClassDecl, ClassMemberDecl, ExprNode, FunDecl, GetExpr, ProgramNode, SetExpr,
StmtNode, VariableExpr,
BinaryExpr, ClassDecl, ClassMemberDecl, ClassMemberKind, ExprNode, FunDecl, GetExpr,
ProgramNode, SetExpr, StmtNode, VariableExpr,
},
errors::{ErrorHandler, ErrorKind, SloxError, SloxResult},
tokens::{Token, TokenType},
@ -238,11 +238,11 @@ impl Parser {
));
}
}
members.push(if static_token.is_some() {
ClassMemberDecl::StaticMethod(d)
} else {
ClassMemberDecl::Method(d)
})
members.push(ClassMemberDecl {
kind: ClassMemberKind::Method,
is_static: static_token.is_some(),
fun_decl: d,
});
}
_ => panic!("Function declaration expected"),
}