| ... | ... | @@ -1653,7 +1653,8 @@ fn renderArrayInit( |
| 1653 | 1653 | try renderToken(ais, tree, array_init.ast.lbrace, .newline); |
| 1654 | 1654 | |
| 1655 | 1655 | var expr_index: usize = 0; |
| 1656 | | while (rowSize(tree, array_init.ast.elements[expr_index..], rbrace)) |row_size| { |
| 1656 | while (true) { |
| 1657 | const row_size = rowSize(tree, array_init.ast.elements[expr_index..], rbrace); |
| 1657 | 1658 | const row_exprs = array_init.ast.elements[expr_index..]; |
| 1658 | 1659 | // A place to store the width of each expression and its column's maximum |
| 1659 | 1660 | const widths = try gpa.alloc(usize, row_exprs.len + row_size); |
| ... | ... | @@ -1686,7 +1687,7 @@ fn renderArrayInit( |
| 1686 | 1687 | const maybe_comma = expr_last_token + 1; |
| 1687 | 1688 | if (token_tags[maybe_comma] == .comma) { |
| 1688 | 1689 | if (hasSameLineComment(tree, maybe_comma)) |
| 1689 | | break :sec_end i - this_line_size.? + 1; |
| 1690 | break :sec_end i - this_line_size + 1; |
| 1690 | 1691 | } |
| 1691 | 1692 | } |
| 1692 | 1693 | break :sec_end row_exprs.len; |
| ... | ... | @@ -2500,9 +2501,8 @@ fn nodeCausesSliceOpSpace(tag: ast.Node.Tag) bool { |
| 2500 | 2501 | }; |
| 2501 | 2502 | } |
| 2502 | 2503 | |
| 2503 | | // Returns the number of nodes in `expr` that are on the same line as `rtoken`, |
| 2504 | | // or null if they all are on the same line. |
| 2505 | | fn rowSize(tree: ast.Tree, exprs: []const ast.Node.Index, rtoken: ast.TokenIndex) ?usize { |
| 2504 | // Returns the number of nodes in `expr` that are on the same line as `rtoken`. |
| 2505 | fn rowSize(tree: ast.Tree, exprs: []const ast.Node.Index, rtoken: ast.TokenIndex) usize { |
| 2506 | 2506 | const token_tags = tree.tokens.items(.tag); |
| 2507 | 2507 | |
| 2508 | 2508 | const first_token = tree.firstToken(exprs[0]); |
| ... | ... | @@ -2510,7 +2510,7 @@ fn rowSize(tree: ast.Tree, exprs: []const ast.Node.Index, rtoken: ast.TokenIndex |
| 2510 | 2510 | const maybe_comma = rtoken - 1; |
| 2511 | 2511 | if (token_tags[maybe_comma] == .comma) |
| 2512 | 2512 | return 1; |
| 2513 | | return null; // no newlines |
| 2513 | return exprs.len; // no newlines |
| 2514 | 2514 | } |
| 2515 | 2515 | |
| 2516 | 2516 | var count: usize = 1; |