Top level

This commit is contained in:
2026-05-21 13:43:42 +02:00
parent 7b94969379
commit 70a1fa332b
2 changed files with 52 additions and 6 deletions
+20
View File
@@ -150,6 +150,26 @@ impl GenRust for ParamList {
}
}
impl GenRust for TopLevel {
fn gen_rust(&self, ctx: &mut Context, cg: &mut RustCodegen) {
if let TopLevelKind::ModAttribute = self.0.item {
for attr in &self.1 {
cg.add("#![");
attr.gen_rust(ctx, cg);
cg.addln("]");
}
} else {
for attr in &self.1 {
cg.add("#[");
attr.gen_rust(ctx, cg);
cg.addln("]");
}
}
self.0.gen_rust(ctx, cg);
}
}
impl GenRust for (&Vec<Spanned<FieldDeclStmt>>, &ClassConstructor) {
fn gen_rust(&self, ctx: &mut Context, cg: &mut RustCodegen) {
cg.add_indentedln(&format!(