Class AST
This commit is contained in:
@@ -74,6 +74,12 @@ pub enum TopLevelKind {
|
|||||||
return_type: TypeExpr,
|
return_type: TypeExpr,
|
||||||
body: Block,
|
body: Block,
|
||||||
},
|
},
|
||||||
|
ClassDecl {
|
||||||
|
export: bool,
|
||||||
|
name: String,
|
||||||
|
fields: Vec<VarDeclStmt>,
|
||||||
|
constructor: (ParamList, Block),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class_decl = {
|
|||||||
|
|
||||||
// ================= TOP LEVEL =================
|
// ================= TOP LEVEL =================
|
||||||
|
|
||||||
top_level = { (attributes ~ (import | function_decl | struct_decl)) | mod_attribute | class_decl }
|
top_level = { (attributes ~ (import | function_decl | struct_decl | class_decl)) | mod_attribute }
|
||||||
|
|
||||||
attribute = {
|
attribute = {
|
||||||
"#" ~ "[" ~ meta ~ "]"
|
"#" ~ "[" ~ meta ~ "]"
|
||||||
|
|||||||
Reference in New Issue
Block a user