From 28e9d08f03b4f6644f917cebff2837c9c590afe0 Mon Sep 17 00:00:00 2001 From: Alexandros Naskos Date: Thu, 11 Jun 2020 03:20:44 +0300 Subject: [PATCH] Stop adding malformed container decls into scopes --- src/analysis.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/analysis.zig b/src/analysis.zig index b8ae5f9..4d8033b 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -1081,7 +1081,6 @@ pub fn iterateSymbolsGlobal( } for (scope.uses) |use| { - // @TODO Resolve uses, iterate over their symbols. const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = use.expr, .handle = handle })) orelse continue; try iterateSymbolsContainer(store, arena, use_expr, handle, callback, context); } @@ -1304,6 +1303,12 @@ fn makeScopeInternal( continue; } + if (decl.cast(ast.Node.ContainerField)) |field| { + if (field.type_expr == null and field.value_expr == null) { + continue; + } + } + if (try scopes.items[scope_idx].decls.put(name, .{ .ast_node = decl })) |existing| { // TODO Record a redefinition error. }