Class AST

This commit is contained in:
2026-05-05 18:30:23 +02:00
parent e7bfd23eb5
commit 1f7db7ff1a
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -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)]
+1 -1
View File
@@ -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 ~ "]"