-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.zig fmt
Milestone
Description
desired:
const else_info: struct {
src: usize,
result: ?*zir.Inst,
} = if (else_node != 0) blk: {
block_scope.break_count += 1;
const sub_scope = &else_scope.base;
break :blk .{
.src = token_starts[tree.lastToken(else_node)],
.result = try expr(mod, sub_scope, block_scope.break_result_loc, else_node),
};
} else .{
.src = token_starts[tree.lastToken(if_full.then_expr)],
.result = null,
};however zig fmt does this:
const else_info: struct {
src: usize,
result: ?*zir.Inst,
} = if (else_node != 0) blk: {
block_scope.break_count += 1;
const sub_scope = &else_scope.base;
break :blk .{
.src = token_starts[tree.lastToken(else_node)],
.result = try expr(mod, sub_scope, block_scope.break_result_loc, else_node),
};
} else
.{
.src = token_starts[tree.lastToken(if_full.then_expr)],
.result = null,
};it messes with the else branch.
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.zig fmt