fix ast.lastToken() does not handle empty error_value
This commit is contained in:
parent
fd2a863245
commit
042b03a06a
11
src/ast.zig
11
src/ast.zig
@ -448,9 +448,18 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
.asm_simple,
|
.asm_simple,
|
||||||
.asm_output,
|
.asm_output,
|
||||||
.asm_input,
|
.asm_input,
|
||||||
.error_value,
|
|
||||||
=> return datas[n].rhs + end_offset,
|
=> 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,
|
.anyframe_literal,
|
||||||
.char_literal,
|
.char_literal,
|
||||||
.integer_literal,
|
.integer_literal,
|
||||||
|
Loading…
Reference in New Issue
Block a user