From 86a1edf9c754545a60549cfb8a9489bf81da5cb4 Mon Sep 17 00:00:00 2001 From: SuperAuguste Date: Thu, 14 May 2020 12:23:26 -0400 Subject: [PATCH] Remove more redundant code, rename function --- src/analysis.zig | 10 +--------- src/main.zig | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/analysis.zig b/src/analysis.zig index 4580f9b..925ae0a 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -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", .{}); -} diff --git a/src/main.zig b/src/main.zig index e47285b..9bde6eb 100644 --- a/src/main.zig +++ b/src/main.zig @@ -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); }