fix missing double reference
This commit is contained in:
parent
aae82d29bd
commit
3f92120fbe
22
src/ast.zig
22
src/ast.zig
@ -524,7 +524,7 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
.struct_init,
|
.struct_init,
|
||||||
=> {
|
=> {
|
||||||
const elements = tree.extraData(datas[n].rhs, Node.SubRange);
|
const elements = tree.extraData(datas[n].rhs, Node.SubRange);
|
||||||
std.debug.std.debug.assert(elements.end - elements.start > 0);
|
std.debug.assert(elements.end - elements.start > 0);
|
||||||
end_offset += 1; // for the rbrace
|
end_offset += 1; // for the rbrace
|
||||||
n = tree.extra_data[elements.end - 1]; // last element
|
n = tree.extra_data[elements.end - 1]; // last element
|
||||||
},
|
},
|
||||||
@ -534,7 +534,7 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
.switch_comma,
|
.switch_comma,
|
||||||
=> {
|
=> {
|
||||||
const members = tree.extraData(datas[n].rhs, Node.SubRange);
|
const members = tree.extraData(datas[n].rhs, Node.SubRange);
|
||||||
std.debug.std.debug.assert(members.end - members.start > 0);
|
std.debug.assert(members.end - members.start > 0);
|
||||||
end_offset += 2; // for the comma + rbrace
|
end_offset += 2; // for the comma + rbrace
|
||||||
n = tree.extra_data[members.end - 1]; // last parameter
|
n = tree.extra_data[members.end - 1]; // last parameter
|
||||||
},
|
},
|
||||||
@ -545,7 +545,7 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
.tagged_union,
|
.tagged_union,
|
||||||
.builtin_call,
|
.builtin_call,
|
||||||
=> {
|
=> {
|
||||||
std.debug.std.debug.assert(datas[n].rhs - datas[n].lhs > 0);
|
std.debug.assert(datas[n].rhs - datas[n].lhs > 0);
|
||||||
end_offset += 1; // for the rbrace
|
end_offset += 1; // for the rbrace
|
||||||
n = tree.extra_data[datas[n].rhs - 1]; // last statement
|
n = tree.extra_data[datas[n].rhs - 1]; // last statement
|
||||||
},
|
},
|
||||||
@ -556,7 +556,7 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
.tagged_union_trailing,
|
.tagged_union_trailing,
|
||||||
.builtin_call_comma,
|
.builtin_call_comma,
|
||||||
=> {
|
=> {
|
||||||
std.debug.std.debug.assert(datas[n].rhs - datas[n].lhs > 0);
|
std.debug.assert(datas[n].rhs - datas[n].lhs > 0);
|
||||||
end_offset += 2; // for the comma/semicolon + rbrace/rparen
|
end_offset += 2; // for the comma/semicolon + rbrace/rparen
|
||||||
n = tree.extra_data[datas[n].rhs - 1]; // last member
|
n = tree.extra_data[datas[n].rhs - 1]; // last member
|
||||||
},
|
},
|
||||||
@ -672,11 +672,11 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
=> {
|
=> {
|
||||||
end_offset += 2; // ellipsis2 + rbracket, or comma + rparen
|
end_offset += 2; // ellipsis2 + rbracket, or comma + rparen
|
||||||
n = datas[n].rhs;
|
n = datas[n].rhs;
|
||||||
std.debug.std.debug.assert(n != 0);
|
std.debug.assert(n != 0);
|
||||||
},
|
},
|
||||||
.slice => {
|
.slice => {
|
||||||
const extra = tree.extraData(datas[n].rhs, Node.Slice);
|
const extra = tree.extraData(datas[n].rhs, Node.Slice);
|
||||||
std.debug.std.debug.assert(extra.end != 0); // should have used slice_open
|
std.debug.assert(extra.end != 0); // should have used slice_open
|
||||||
end_offset += 1; // rbracket
|
end_offset += 1; // rbracket
|
||||||
n = extra.end;
|
n = extra.end;
|
||||||
},
|
},
|
||||||
@ -782,7 +782,7 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (max_node == 0) {
|
if (max_node == 0) {
|
||||||
std.debug.std.debug.assert(max_offset == 0);
|
std.debug.assert(max_offset == 0);
|
||||||
// No linksection, callconv, align, return type
|
// No linksection, callconv, align, return type
|
||||||
if (extra.param != 0) {
|
if (extra.param != 0) {
|
||||||
n = extra.param;
|
n = extra.param;
|
||||||
@ -834,7 +834,7 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (max_node == 0) {
|
if (max_node == 0) {
|
||||||
std.debug.std.debug.assert(max_offset == 0);
|
std.debug.assert(max_offset == 0);
|
||||||
// No linksection, callconv, align, return type
|
// No linksection, callconv, align, return type
|
||||||
// Use the last parameter and skip one extra token for the right paren
|
// Use the last parameter and skip one extra token for the right paren
|
||||||
n = extra.params_end;
|
n = extra.params_end;
|
||||||
@ -846,17 +846,17 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
},
|
},
|
||||||
.while_cont => {
|
.while_cont => {
|
||||||
const extra = tree.extraData(datas[n].rhs, Node.WhileCont);
|
const extra = tree.extraData(datas[n].rhs, Node.WhileCont);
|
||||||
std.debug.std.debug.assert(extra.then_expr != 0);
|
std.debug.assert(extra.then_expr != 0);
|
||||||
n = extra.then_expr;
|
n = extra.then_expr;
|
||||||
},
|
},
|
||||||
.@"while" => {
|
.@"while" => {
|
||||||
const extra = tree.extraData(datas[n].rhs, Node.While);
|
const extra = tree.extraData(datas[n].rhs, Node.While);
|
||||||
std.debug.std.debug.assert(extra.else_expr != 0);
|
std.debug.assert(extra.else_expr != 0);
|
||||||
n = extra.else_expr;
|
n = extra.else_expr;
|
||||||
},
|
},
|
||||||
.@"if", .@"for" => {
|
.@"if", .@"for" => {
|
||||||
const extra = tree.extraData(datas[n].rhs, Node.If);
|
const extra = tree.extraData(datas[n].rhs, Node.If);
|
||||||
std.debug.std.debug.assert(extra.else_expr != 0);
|
std.debug.assert(extra.else_expr != 0);
|
||||||
n = extra.else_expr;
|
n = extra.else_expr;
|
||||||
},
|
},
|
||||||
.@"suspend" => {
|
.@"suspend" => {
|
||||||
|
Loading…
Reference in New Issue
Block a user