| ... | @@ -1449,6 +1449,8 @@ fn renderFnProto(gpa: *Allocator, ais: *Ais, tree: ast.Tree, fn_proto: ast.full. | ... | @@ -1449,6 +1449,8 @@ fn renderFnProto(gpa: *Allocator, ais: *Ais, tree: ast.Tree, fn_proto: ast.full. |
| 1449 | .identifier => {}, | 1449 | .identifier => {}, |
| 1450 | .keyword_anytype => { | 1450 | .keyword_anytype => { |
| 1451 | try renderToken(ais, tree, last_param_token, .comma); // anytype | 1451 | try renderToken(ais, tree, last_param_token, .comma); // anytype |
| | 1452 | if (token_tags[last_param_token + 1] == .comma) |
| | 1453 | last_param_token += 1; |
| 1452 | continue; | 1454 | continue; |
| 1453 | }, | 1455 | }, |
| 1454 | .r_paren => break, | 1456 | .r_paren => break, |
| ... | @@ -1462,6 +1464,8 @@ fn renderFnProto(gpa: *Allocator, ais: *Ais, tree: ast.Tree, fn_proto: ast.full. | ... | @@ -1462,6 +1464,8 @@ fn renderFnProto(gpa: *Allocator, ais: *Ais, tree: ast.Tree, fn_proto: ast.full. |
| 1462 | } | 1464 | } |
| 1463 | if (token_tags[last_param_token] == .keyword_anytype) { | 1465 | if (token_tags[last_param_token] == .keyword_anytype) { |
| 1464 | try renderToken(ais, tree, last_param_token, .comma); // anytype | 1466 | try renderToken(ais, tree, last_param_token, .comma); // anytype |
| | 1467 | if (token_tags[last_param_token + 1] == .comma) |
| | 1468 | last_param_token += 1; |
| 1465 | continue; | 1469 | continue; |
| 1466 | } | 1470 | } |
| 1467 | const param = fn_proto.ast.params[param_i]; | 1471 | const param = fn_proto.ast.params[param_i]; |
| ... | @@ -2363,6 +2367,12 @@ fn renderContainerDocComments(ais: *Ais, tree: ast.Tree, start_token: ast.TokenI | ... | @@ -2363,6 +2367,12 @@ fn renderContainerDocComments(ais: *Ais, tree: ast.Tree, start_token: ast.TokenI |
| 2363 | while (token_tags[tok] == .container_doc_comment) : (tok += 1) { | 2367 | while (token_tags[tok] == .container_doc_comment) : (tok += 1) { |
| 2364 | try renderToken(ais, tree, tok, .newline); | 2368 | try renderToken(ais, tree, tok, .newline); |
| 2365 | } | 2369 | } |
| | 2370 | // Render extra newline if there is one between final container doc comment and |
| | 2371 | // the next token. If the next token is a doc comment, that code path |
| | 2372 | // will have its own logic to insert a newline. |
| | 2373 | if (token_tags[tok] != .doc_comment) { |
| | 2374 | try renderExtraNewlineToken(ais, tree, tok); |
| | 2375 | } |
| 2366 | } | 2376 | } |
| 2367 | | 2377 | |
| 2368 | fn tokenSliceForRender(tree: ast.Tree, token_index: ast.TokenIndex) []const u8 { | 2378 | fn tokenSliceForRender(tree: ast.Tree, token_index: ast.TokenIndex) []const u8 { |