fix ast.lastToken() does not handle empty error_value

This commit is contained in:
v1nh1shungry 2022-04-20 14:49:52 +08:00
parent fd2a863245
commit 042b03a06a

View File

@ -448,9 +448,18 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
.asm_simple,
.asm_output,
.asm_input,
.error_value,
=> return datas[n].rhs + end_offset,
.error_value => {
if (datas[n].rhs != 0) {
return datas[n].rhs + end_offset;
} else if (datas[n].lhs != 0) {
return datas[n].lhs + end_offset;
} else {
return main_tokens[n] + end_offset;
}
},
.anyframe_literal,
.char_literal,
.integer_literal,