| ... | @@ -676,20 +676,11 @@ pub const Tree = struct { | ... | @@ -676,20 +676,11 @@ pub const Tree = struct { |
| 676 | }, | 676 | }, |
| 677 | .ArrayInitDotTwo, | 677 | .ArrayInitDotTwo, |
| 678 | .BlockTwo, | 678 | .BlockTwo, |
| | 679 | .BuiltinCallTwo, |
| 679 | .StructInitDotTwo, | 680 | .StructInitDotTwo, |
| 680 | .ContainerDeclTwo, | 681 | .ContainerDeclTwo, |
| 681 | .TaggedUnionTwo, | 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 | if (datas[n].rhs != 0) { | 684 | if (datas[n].rhs != 0) { |
| 694 | end_offset += 1; // for the rparen/rbrace | 685 | end_offset += 1; // for the rparen/rbrace |
| 695 | n = datas[n].rhs; | 686 | n = datas[n].rhs; |
| ... | @@ -697,7 +688,17 @@ pub const Tree = struct { | ... | @@ -697,7 +688,17 @@ pub const Tree = struct { |
| 697 | end_offset += 1; // for the rparen/rbrace | 688 | end_offset += 1; // for the rparen/rbrace |
| 698 | n = datas[n].lhs; | 689 | n = datas[n].lhs; |
| 699 | } else { | 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 | return main_tokens[n] + end_offset; | 702 | return main_tokens[n] + end_offset; |
| 702 | } | 703 | } |
| 703 | }, | 704 | }, |
| ... | @@ -2708,7 +2709,7 @@ pub const Node = struct { | ... | @@ -2708,7 +2709,7 @@ pub const Node = struct { |
| 2708 | /// `{}`. `sub_list[lhs..rhs]`. | 2709 | /// `{}`. `sub_list[lhs..rhs]`. |
| 2709 | /// main_token points at the lbrace. | 2710 | /// main_token points at the lbrace. |
| 2710 | Block, | 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 | BlockSemicolon, | 2713 | BlockSemicolon, |
| 2713 | /// `asm(lhs)`. rhs is the token index of the rparen. | 2714 | /// `asm(lhs)`. rhs is the token index of the rparen. |
| 2714 | AsmSimple, | 2715 | AsmSimple, |