Remove more redundant code, rename function
This commit is contained in:
parent
58015dcd64
commit
86a1edf9c7
@ -341,7 +341,7 @@ pub fn getFieldAccessTypeNode(analysis_ctx: *AnalysisContext, tokenizer: *std.zi
|
|||||||
return current_node;
|
return current_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn isPublic(tree: *ast.Tree, node: *ast.Node) bool {
|
pub fn isNodePublic(tree: *ast.Tree, node: *ast.Node) bool {
|
||||||
switch (node.id) {
|
switch (node.id) {
|
||||||
.VarDecl => {
|
.VarDecl => {
|
||||||
const var_decl = node.cast(ast.Node.VarDecl).?;
|
const var_decl = node.cast(ast.Node.VarDecl).?;
|
||||||
@ -389,11 +389,3 @@ pub fn nodeToString(tree: *ast.Tree, node: *ast.Node) ?[]const u8 {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn nodesToString(tree: *ast.Tree, maybe_nodes: ?[]*ast.Node) void {
|
|
||||||
if (maybe_nodes) |nodes| {
|
|
||||||
for (nodes) |node| {
|
|
||||||
std.debug.warn("- {}\n", .{nodeToString(tree, node)});
|
|
||||||
}
|
|
||||||
} else std.debug.warn("No nodes\n", .{});
|
|
||||||
}
|
|
||||||
|
@ -277,7 +277,7 @@ fn completeFieldAccess(id: i64, handle: *DocumentStore.Handle, position: types.P
|
|||||||
if (analysis.getFieldAccessTypeNode(&analysis_ctx, &tokenizer)) |node| {
|
if (analysis.getFieldAccessTypeNode(&analysis_ctx, &tokenizer)) |node| {
|
||||||
var index: usize = 0;
|
var index: usize = 0;
|
||||||
while (node.iterate(index)) |child_node| {
|
while (node.iterate(index)) |child_node| {
|
||||||
if (analysis.isPublic(analysis_ctx.tree, child_node)) {
|
if (analysis.isNodePublic(analysis_ctx.tree, child_node)) {
|
||||||
if (try nodeToCompletion(&arena.allocator, analysis_ctx.tree, child_node, config)) |completion| {
|
if (try nodeToCompletion(&arena.allocator, analysis_ctx.tree, child_node, config)) |completion| {
|
||||||
try completions.append(completion);
|
try completions.append(completion);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user