| ... | @@ -1924,8 +1924,6 @@ const Space = enum { | ... | @@ -1924,8 +1924,6 @@ const Space = enum { |
| 1924 | /// Additionally consume the next token if it is a semicolon. | 1924 | /// Additionally consume the next token if it is a semicolon. |
| 1925 | /// In either case, a newline will be inserted afterwards. | 1925 | /// In either case, a newline will be inserted afterwards. |
| 1926 | semicolon, | 1926 | semicolon, |
| 1927 | /// Skips writing the possible line comment after the token. | | |
| 1928 | no_comment, | | |
| 1929 | }; | 1927 | }; |
| 1930 | | 1928 | |
| 1931 | fn renderToken(ais: *Ais, tree: ast.Tree, token_index: ast.TokenIndex, space: Space) Error!void { | 1929 | fn renderToken(ais: *Ais, tree: ast.Tree, token_index: ast.TokenIndex, space: Space) Error!void { |
| ... | @@ -1937,8 +1935,6 @@ fn renderToken(ais: *Ais, tree: ast.Tree, token_index: ast.TokenIndex, space: Sp | ... | @@ -1937,8 +1935,6 @@ fn renderToken(ais: *Ais, tree: ast.Tree, token_index: ast.TokenIndex, space: Sp |
| 1937 | | 1935 | |
| 1938 | try ais.writer().writeAll(lexeme); | 1936 | try ais.writer().writeAll(lexeme); |
| 1939 | | 1937 | |
| 1940 | if (space == .no_comment) return; | | |
| 1941 | | | |
| 1942 | const comment = try renderComments(ais, tree, token_start + lexeme.len, token_starts[token_index + 1]); | 1938 | const comment = try renderComments(ais, tree, token_start + lexeme.len, token_starts[token_index + 1]); |
| 1943 | switch (space) { | 1939 | switch (space) { |
| 1944 | .none => {}, | 1940 | .none => {}, |
| ... | @@ -1962,8 +1958,6 @@ fn renderToken(ais: *Ais, tree: ast.Tree, token_index: ast.TokenIndex, space: Sp | ... | @@ -1962,8 +1958,6 @@ fn renderToken(ais: *Ais, tree: ast.Tree, token_index: ast.TokenIndex, space: Sp |
| 1962 | } else if (!comment) { | 1958 | } else if (!comment) { |
| 1963 | try ais.insertNewline(); | 1959 | try ais.insertNewline(); |
| 1964 | }, | 1960 | }, |
| 1965 | | | |
| 1966 | .no_comment => unreachable, | | |
| 1967 | } | 1961 | } |
| 1968 | } | 1962 | } |
| 1969 | | 1963 | |
| ... | @@ -2064,12 +2058,7 @@ fn renderDocComments(ais: *Ais, tree: ast.Tree, end_token: ast.TokenIndex) Error | ... | @@ -2064,12 +2058,7 @@ fn renderDocComments(ais: *Ais, tree: ast.Tree, end_token: ast.TokenIndex) Error |
| 2064 | try renderExtraNewlineToken(ais, tree, first_tok); | 2058 | try renderExtraNewlineToken(ais, tree, first_tok); |
| 2065 | | 2059 | |
| 2066 | while (token_tags[tok] == .doc_comment) : (tok += 1) { | 2060 | while (token_tags[tok] == .doc_comment) : (tok += 1) { |
| 2067 | if (first_tok < end_token) { | 2061 | try renderToken(ais, tree, tok, .newline); |
| 2068 | try renderToken(ais, tree, tok, .newline); | | |
| 2069 | } else { | | |
| 2070 | try renderToken(ais, tree, tok, .no_comment); | | |
| 2071 | try ais.insertNewline(); | | |
| 2072 | } | | |
| 2073 | } | 2062 | } |
| 2074 | } | 2063 | } |
| 2075 | | 2064 | |