zig fmt: Fix erroneously commented out code, add passing test case to close #5722

master
Lachlan Easton 2020-08-30 15:02:05 +10:00
parent ea6181aaf6
commit 9f0821e688
2 changed files with 16 additions and 1 deletions

View File

@ -3429,6 +3429,21 @@ test "zig fmt: Control flow statement as body of blockless if" {
); );
} }
test "zig fmt: " {
try testCanonical(
\\pub fn sendViewTags(self: Self) void {
\\ var it = ViewStack(View).iterator(self.output.views.first, std.math.maxInt(u32));
\\ while (it.next()) |node|
\\ view_tags.append(node.view.current_tags) catch {
\\ c.wl_resource_post_no_memory(self.wl_resource);
\\ log.crit(.river_status, "out of memory", .{});
\\ return;
\\ };
\\}
\\
);
}
const std = @import("std"); const std = @import("std");
const mem = std.mem; const mem = std.mem;
const warn = std.debug.warn; const warn = std.debug.warn;

View File

@ -1762,7 +1762,7 @@ fn renderExpression(
} }
if (while_node.payload) |payload| { if (while_node.payload) |payload| {
const payload_space = Space.Space; //if (while_node.continue_expr != null) Space.Space else block_start_space; const payload_space = if (while_node.continue_expr != null) Space.Space else block_start_space;
try renderExpression(allocator, ais, tree, payload, payload_space); try renderExpression(allocator, ais, tree, payload, payload_space);
} }