AST - Refactored class member representation
This commit is contained in:
parent
6387615f68
commit
52c4b6315e
1 changed files with 8 additions and 1 deletions
|
@ -16,11 +16,18 @@ pub struct FunDecl {
|
||||||
pub body: Vec<StmtNode>,
|
pub body: Vec<StmtNode>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The declaration of a class member.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum ClassMemberDecl {
|
||||||
|
Method(FunDecl),
|
||||||
|
StaticMethod(FunDecl),
|
||||||
|
}
|
||||||
|
|
||||||
/// A class declaration.
|
/// A class declaration.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ClassDecl {
|
pub struct ClassDecl {
|
||||||
pub name: Token,
|
pub name: Token,
|
||||||
pub methods: Vec<FunDecl>,
|
pub members: Vec<ClassMemberDecl>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An AST node that represents a statement.
|
/// An AST node that represents a statement.
|
||||||
|
|
Loading…
Reference in a new issue