| ... | ... | @@ -676,20 +676,11 @@ pub const Tree = struct { |
| 676 | 676 | }, |
| 677 | 677 | .ArrayInitDotTwo, |
| 678 | 678 | .BlockTwo, |
| 679 | .BuiltinCallTwo, |
| 679 | 680 | .StructInitDotTwo, |
| 680 | 681 | .ContainerDeclTwo, |
| 681 | 682 | .TaggedUnionTwo, |
| 682 | 683 | => { |
| 683 | | end_offset += 1; // for the rparen/rbrace |
| 684 | | if (datas[n].rhs != 0) { |
| 685 | | n = datas[n].rhs; |
| 686 | | } else if (datas[n].lhs != 0) { |
| 687 | | n = datas[n].lhs; |
| 688 | | } else { |
| 689 | | return main_tokens[n] + end_offset; |
| 690 | | } |
| 691 | | }, |
| 692 | | .BuiltinCallTwo => { |
| 693 | 684 | if (datas[n].rhs != 0) { |
| 694 | 685 | end_offset += 1; // for the rparen/rbrace |
| 695 | 686 | n = datas[n].rhs; |
| ... | ... | @@ -697,7 +688,17 @@ pub const Tree = struct { |
| 697 | 688 | end_offset += 1; // for the rparen/rbrace |
| 698 | 689 | n = datas[n].lhs; |
| 699 | 690 | } else { |
| 700 | | end_offset += 2; // for the lparen and rparen |
| 691 | switch (tags[n]) { |
| 692 | .ArrayInitDotTwo, |
| 693 | .BlockTwo, |
| 694 | .StructInitDotTwo, |
| 695 | => end_offset += 1, // rbrace |
| 696 | .BuiltinCallTwo, |
| 697 | .ContainerDeclTwo, |
| 698 | => end_offset += 2, // lparen/lbrace + rparen/rbrace |
| 699 | .TaggedUnionTwo => end_offset += 5, // (enum) {} |
| 700 | else => unreachable, |
| 701 | } |
| 701 | 702 | return main_tokens[n] + end_offset; |
| 702 | 703 | } |
| 703 | 704 | }, |
| ... | ... | @@ -2708,7 +2709,7 @@ pub const Node = struct { |
| 2708 | 2709 | /// `{}`. `sub_list[lhs..rhs]`. |
| 2709 | 2710 | /// main_token points at the lbrace. |
| 2710 | 2711 | Block, |
| 2711 | | /// Same as BlockTwo but there is known to be a semicolon before the rbrace. |
| 2712 | /// Same as Block but there is known to be a semicolon before the rbrace. |
| 2712 | 2713 | BlockSemicolon, |
| 2713 | 2714 | /// `asm(lhs)`. rhs is the token index of the rparen. |
| 2714 | 2715 | AsmSimple, |