authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-02-09 22:28:55-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-02-09 22:29:01-07:00
log9d87e6aeb8dd9c46b10483c31a392d7dac8a7dc4
treecc857e7c1b9dd54f82fd993b834bda7b9f7899c2
parent36eee7bc6cbe6fcc388ebdc38fd3c5f06c9e9043

zig fmt: remove dead code

likely these will be resurrected to make array literal cases pass.

1 files changed, 0 insertions(+), 35 deletions(-)

lib/std/zig/render.zig-35
...@@ -2106,38 +2106,3 @@ fn nodeCausesSliceOpSpace(tag: ast.Node.Tag) bool {...@@ -2106,38 +2106,3 @@ fn nodeCausesSliceOpSpace(tag: ast.Node.Tag) bool {
2106 else => false,2106 else => false,
2107 };2107 };
2108}2108}
2109
2110fn copyFixingWhitespace(ais: *Ais, slice: []const u8) @TypeOf(ais.*).Error!void {
2111 const writer = ais.writer();
2112 for (slice) |byte| switch (byte) {
2113 '\t' => try writer.writeAll(" "),
2114 '\r' => {},
2115 else => try writer.writeByte(byte),
2116 };
2117}
2118
2119// Returns the number of nodes in `expr` that are on the same line as `rtoken`,
2120// or null if they all are on the same line.
2121fn rowSize(tree: ast.Tree, exprs: []ast.Node.Index, rtoken: ast.TokenIndex) ?usize {
2122 const first_token = exprs[0].firstToken();
2123 const first_loc = tree.tokenLocation(tree.token_locs[first_token].start, rtoken);
2124 if (first_loc.line == 0) {
2125 const maybe_comma = tree.prevToken(rtoken);
2126 if (tree.token_tags[maybe_comma] == .Comma)
2127 return 1;
2128 return null; // no newlines
2129 }
2130
2131 var count: usize = 1;
2132 for (exprs) |expr, i| {
2133 if (i + 1 < exprs.len) {
2134 const expr_last_token = expr.lastToken() + 1;
2135 const loc = tree.tokenLocation(tree.token_locs[expr_last_token].start, exprs[i + 1].firstToken());
2136 if (loc.line != 0) return count;
2137 count += 1;
2138 } else {
2139 return count;
2140 }
2141 }
2142 unreachable;
2143}