fix lastToken on tagged union with invalid members

This commit is contained in:
Techatrix 2023-03-07 12:45:54 +01:00 committed by Lee Cannon
parent 2ce59a3bc3
commit ce9ae21cf4

View File

@ -572,7 +572,9 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
=> {
end_offset += 2; // for the comma/semicolon + rparen/rbrace
const params = tree.extraData(datas[n].rhs, Node.SubRange);
std.debug.assert(params.end > params.start);
if (params.end - params.start == 0) {
return main_tokens[n] + end_offset;
}
n = tree.extra_data[params.end - 1]; // last parameter
},
.@"switch" => {