AST - Added property getters/setters

This commit is contained in:
Emmanuel BENOîT 2023-01-14 10:56:10 +01:00
parent 373668fc23
commit ddb2c94ae5

View file

@ -16,11 +16,22 @@ pub struct FunDecl {
pub body: Vec<StmtNode>,
}
/// A getter method for a property
#[derive(Debug, Clone)]
pub struct PropertyAccessor {
pub name: Token,
pub body: Vec<StmtNode>,
}
/// The declaration of a class member.
#[derive(Debug, Clone)]
pub enum ClassMemberDecl {
Method(FunDecl),
StaticMethod(FunDecl),
PropertyGetter(PropertyAccessor),
StaticPropertyGetter(PropertyAccessor),
PropertySetter(PropertyAccessor),
StaticPropertySetter(PropertyAccessor),
}
/// A class declaration.