Top level as statement #103

This commit is contained in:
2026-07-02 06:25:44 +02:00
parent 9021da224e
commit 68cf239f92
7 changed files with 21 additions and 2 deletions
+1
View File
@@ -33,6 +33,7 @@ impl GenMist for Statement {
cg.add("unsafe ");
block.gen_mist(ctx, cg);
}
Statement::TopLevel(tl) => tl.gen_mist(ctx, cg),
Statement::Block(block) => block.gen_mist(ctx, cg),
Statement::VarDecl(VarDeclStmt { decl, init }) => {
if decl.type_.is_some() {
+3 -2
View File
@@ -31,13 +31,14 @@ impl GenRust for Block {
impl GenRust for Statement {
fn gen_rust(&self, ctx: &mut Context, cg: &mut RustCodegen) {
match self {
Statement::TopLevel(tl) => tl.gen_rust(ctx, cg),
Statement::Block(block) => block.gen_rust(ctx, cg),
Statement::UnsafeBlock(block) => {
cg.add("unsafe ");
block.gen_rust(ctx, cg);
}
Statement::Block(block) => block.gen_rust(ctx, cg),
Statement::VarDecl(VarDeclStmt { decl, init }) => {
cg.add("let ");
decl.gen_rust(ctx, cg);