authorgravatar for lachlan@lakebythewoods.xyzLachlan Easton <lachlan@lakebythewoods.xyz> 2020-08-30 15:02:05+10:00
committergravatar for lachlan@lakebythewoods.xyzLachlan Easton <lachlan@lakebythewoods.xyz> 2020-09-18 20:34:00+10:00
log9f0821e68836a495c726e0aae13e62c5235c5446
tree54588c850730d996b9768b7323a9db39efad6506
parentea6181aaf6c3e22ced8b8ac202c5fc93a8e90674

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


2 files changed, 16 insertions(+), 1 deletions(-)

lib/std/zig/parser_test.zig+15
...@@ -3429,6 +3429,21 @@ test "zig fmt: Control flow statement as body of blockless if" {...@@ -3429,6 +3429,21 @@ test "zig fmt: Control flow statement as body of blockless if" {
3429 );3429 );
3430}3430}
34313431
3432test "zig fmt: " {
3433 try testCanonical(
3434 \\pub fn sendViewTags(self: Self) void {
3435 \\ var it = ViewStack(View).iterator(self.output.views.first, std.math.maxInt(u32));
3436 \\ while (it.next()) |node|
3437 \\ view_tags.append(node.view.current_tags) catch {
3438 \\ c.wl_resource_post_no_memory(self.wl_resource);
3439 \\ log.crit(.river_status, "out of memory", .{});
3440 \\ return;
3441 \\ };
3442 \\}
3443 \\
3444 );
3445}
3446
3432const std = @import("std");3447const std = @import("std");
3433const mem = std.mem;3448const mem = std.mem;
3434const warn = std.debug.warn;3449const warn = std.debug.warn;
lib/std/zig/render.zig+1-1
...@@ -1762,7 +1762,7 @@ fn renderExpression(...@@ -1762,7 +1762,7 @@ fn renderExpression(
1762 }1762 }
17631763
1764 if (while_node.payload) |payload| {1764 if (while_node.payload) |payload| {
1765 const payload_space = Space.Space; //if (while_node.continue_expr != null) Space.Space else block_start_space;1765 const payload_space = if (while_node.continue_expr != null) Space.Space else block_start_space;
1766 try renderExpression(allocator, ais, tree, payload, payload_space);1766 try renderExpression(allocator, ais, tree, payload, payload_space);
1767 }1767 }
17681768