From dc292e74ee0f0cbe5d87f88458b5fbf6d2a4e7f3 Mon Sep 17 00:00:00 2001 From: SuperAuguste Date: Wed, 13 May 2020 11:43:28 -0400 Subject: [PATCH] null bug fixes --- src/analysis.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/analysis.zig b/src/analysis.zig index 40e327b..9b87ea4 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -221,7 +221,9 @@ pub fn getNodeFromTokens(tree: *std.zig.ast.Tree, node: *std.zig.ast.Node, token // current_node. if (getChild(tree, current_node, tokenizer.buffer[next.start..next.end])) |child| { if (resolveTypeOfNode(tree, child)) |node_type| { - current_node = resolveTypeOfNode(tree, child).?; + if (resolveTypeOfNode(tree, child)) |child_type| { + current_node = child_type; + } else return null; } } else return null; }, @@ -231,8 +233,9 @@ pub fn getNodeFromTokens(tree: *std.zig.ast.Tree, node: *std.zig.ast.Node, token return current_node; } else if (after_period.id == .Identifier) { if (getChild(tree, current_node, tokenizer.buffer[after_period.start..after_period.end])) |child| { - // std.debug.warn("{}", .{child}); - current_node = resolveTypeOfNode(tree, child).?; + if (resolveTypeOfNode(tree, child)) |child_type| { + current_node = child_type; + } else return null; } else return null; } },