Removed all zig.ast.Tree methods that call lastToken with our own versions
This commit is contained in:
@@ -120,7 +120,7 @@ fn symbolReferencesInternal(
|
||||
.error_set_decl,
|
||||
=> {
|
||||
var buf: [2]ast.Node.Index = undefined;
|
||||
for (analysis.declMembers(tree, node, &buf)) |member|
|
||||
for (declMembers(tree, node, &buf)) |member|
|
||||
try symbolReferencesInternal(arena, store, .{ .node = member, .handle = handle }, decl, encoding, context, handler);
|
||||
},
|
||||
.global_var_decl,
|
||||
@@ -128,7 +128,7 @@ fn symbolReferencesInternal(
|
||||
.simple_var_decl,
|
||||
.aligned_var_decl,
|
||||
=> {
|
||||
const var_decl = analysis.varDecl(tree, node).?;
|
||||
const var_decl = varDecl(tree, node).?;
|
||||
if (var_decl.ast.type_node != 0) {
|
||||
try symbolReferencesInternal(arena, store, .{ .node = var_decl.ast.type_node, .handle = handle }, decl, encoding, context, handler);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ fn symbolReferencesInternal(
|
||||
.container_field_align,
|
||||
.container_field_init,
|
||||
=> {
|
||||
const field = analysis.containerField(tree, node).?;
|
||||
const field = containerField(tree, node).?;
|
||||
if (field.ast.type_expr != 0) {
|
||||
try symbolReferencesInternal(arena, store, .{ .node = field.ast.type_expr, .handle = handle }, decl, encoding, context, handler);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ fn symbolReferencesInternal(
|
||||
.fn_decl,
|
||||
=> {
|
||||
var buf: [1]ast.Node.Index = undefined;
|
||||
const fn_proto = analysis.fnProto(tree, node, &buf).?;
|
||||
const fn_proto = fnProto(tree, node, &buf).?;
|
||||
var it = fn_proto.iterate(tree);
|
||||
while (it.next()) |param| {
|
||||
if (param.type_expr != 0)
|
||||
@@ -231,14 +231,7 @@ fn symbolReferencesInternal(
|
||||
.for_simple,
|
||||
.@"for",
|
||||
=> {
|
||||
const loop: ast.full.While = switch (node_tags[node]) {
|
||||
.@"while" => tree.whileFull(node),
|
||||
.while_simple => tree.whileSimple(node),
|
||||
.while_cont => tree.whileCont(node),
|
||||
.for_simple => tree.forSimple(node),
|
||||
.@"for" => tree.forFull(node),
|
||||
else => unreachable,
|
||||
};
|
||||
const loop = whileAst(tree, node).?;
|
||||
try symbolReferencesInternal(arena, store, .{ .node = loop.ast.cond_expr, .handle = handle }, decl, encoding, context, handler);
|
||||
if (loop.ast.cont_expr != 0) {
|
||||
try symbolReferencesInternal(arena, store, .{ .node = loop.ast.cont_expr, .handle = handle }, decl, encoding, context, handler);
|
||||
@@ -251,7 +244,7 @@ fn symbolReferencesInternal(
|
||||
.@"if",
|
||||
.if_simple,
|
||||
=> {
|
||||
const if_node: ast.full.If = if (node_tags[node] == .@"if") ifFull(tree, node) else tree.ifSimple(node);
|
||||
const if_node: ast.full.If = if (node_tags[node] == .@"if") ifFull(tree, node) else ifSimple(tree, node);
|
||||
|
||||
try symbolReferencesInternal(arena, store, .{ .node = if_node.ast.cond_expr, .handle = handle }, decl, encoding, context, handler);
|
||||
try symbolReferencesInternal(arena, store, .{ .node = if_node.ast.then_expr, .handle = handle }, decl, encoding, context, handler);
|
||||
@@ -270,7 +263,7 @@ fn symbolReferencesInternal(
|
||||
.ptr_type_bit_range,
|
||||
.ptr_type_sentinel,
|
||||
=> {
|
||||
const ptr_type = analysis.ptrType(tree, node).?;
|
||||
const ptr_type = ptrType(tree, node).?;
|
||||
|
||||
if (ptr_type.ast.align_node != 0) {
|
||||
try symbolReferencesInternal(arena, store, .{ .node = ptr_type.ast.align_node, .handle = handle }, decl, encoding, context, handler);
|
||||
@@ -582,7 +575,7 @@ pub fn symbolReferences(
|
||||
switch (scope.data) {
|
||||
.function => |proto| {
|
||||
var buf: [1]ast.Node.Index = undefined;
|
||||
const fn_proto = analysis.fnProto(curr_handle.tree, proto, &buf).?;
|
||||
const fn_proto = fnProto(curr_handle.tree, proto, &buf).?;
|
||||
var it = fn_proto.iterate(curr_handle.tree);
|
||||
while (it.next()) |candidate| {
|
||||
if (std.meta.eql(candidate, param)) {
|
||||
|
||||
Reference in New Issue
Block a user