Remove more redundant code, rename function

This commit is contained in:
SuperAuguste 2020-05-14 12:23:26 -04:00
parent 58015dcd64
commit 86a1edf9c7
2 changed files with 2 additions and 10 deletions

View File

@ -341,7 +341,7 @@ pub fn getFieldAccessTypeNode(analysis_ctx: *AnalysisContext, tokenizer: *std.zi
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) {
.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;
}
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", .{});
}

View File

@ -277,7 +277,7 @@ fn completeFieldAccess(id: i64, handle: *DocumentStore.Handle, position: types.P
if (analysis.getFieldAccessTypeNode(&analysis_ctx, &tokenizer)) |node| {
var index: usize = 0;
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| {
try completions.append(completion);
}