Collects all statements seen by this case into a block. Avoids creating a block if the first statement is a break or return.
fn transSwitchProngStmt(
t: *Translator,
scope: *Scope,
stmt: Node.Index,
body: []const Node.Index,
) TransError!ZigNode
fn transSwitchProngStmt(
t: *Translator,
scope: *Scope,
stmt: Node.Index,
body: []const Node.Index,
) TransError!ZigNode {
switch (stmt.get(t.tree)) {
.case_stmt, .default_stmt => unreachable,
else => {
var block_scope = try Scope.Block.init(t, scope, false);
defer block_scope.deinit();
// we do not need to translate `stmt` since it is the first stmt of `body`
try t.transSwitchProngStmtInline(&block_scope, body);
return try block_scope.complete();
},
}
}