AST - Added property getters/setters
This commit is contained in:
parent
373668fc23
commit
ddb2c94ae5
1 changed files with 11 additions and 0 deletions
11
src/ast.rs
11
src/ast.rs
|
@ -16,11 +16,22 @@ pub struct FunDecl {
|
||||||
pub body: Vec<StmtNode>,
|
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.
|
/// The declaration of a class member.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ClassMemberDecl {
|
pub enum ClassMemberDecl {
|
||||||
Method(FunDecl),
|
Method(FunDecl),
|
||||||
StaticMethod(FunDecl),
|
StaticMethod(FunDecl),
|
||||||
|
PropertyGetter(PropertyAccessor),
|
||||||
|
StaticPropertyGetter(PropertyAccessor),
|
||||||
|
PropertySetter(PropertyAccessor),
|
||||||
|
StaticPropertySetter(PropertyAccessor),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A class declaration.
|
/// A class declaration.
|
||||||
|
|
Loading…
Reference in a new issue