| ... | ... | @@ -1930,15 +1930,24 @@ fn renderContainerDecl( |
| 1930 | 1930 | |
| 1931 | 1931 | const src_has_trailing_comma = token_tags[rbrace - 1] == .comma; |
| 1932 | 1932 | if (!src_has_trailing_comma) one_line: { |
| 1933 | | // We can only print all the members in-line if there are no comments or multiline strings, |
| 1934 | | // and all the members are fields. |
| 1933 | // We print all the members in-line unless one of the following conditions are true: |
| 1934 | |
| 1935 | // 1. The container has comments or multiline strings. |
| 1935 | 1936 | if (hasComment(tree, lbrace, rbrace) or hasMultilineString(tree, lbrace, rbrace)) { |
| 1936 | 1937 | break :one_line; |
| 1937 | 1938 | } |
| 1939 | |
| 1940 | // 2. A member of the container has a doc comment. |
| 1941 | for (token_tags[lbrace + 1 .. rbrace - 1]) |tag| { |
| 1942 | if (tag == .doc_comment) break :one_line; |
| 1943 | } |
| 1944 | |
| 1945 | // 3. The container has non-field members. |
| 1938 | 1946 | for (container_decl.ast.members) |member| { |
| 1939 | 1947 | if (!node_tags[member].isContainerField()) break :one_line; |
| 1940 | 1948 | } |
| 1941 | | // All the declarations on the same line. |
| 1949 | |
| 1950 | // Print all the declarations on the same line. |
| 1942 | 1951 | try renderToken(ais, tree, lbrace, .space); // lbrace |
| 1943 | 1952 | for (container_decl.ast.members) |member| { |
| 1944 | 1953 | try renderMember(gpa, ais, tree, member, .space); |