Fixed enum completion bug

This commit is contained in:
Alexandros Naskos 2020-07-08 04:11:52 +03:00
parent 62774d065b
commit e1bce76c63

View File

@ -2044,10 +2044,11 @@ fn makeScopeInternal(
if (node.cast(ast.Node.ContainerDecl)) |container| {
const kind = tree.token_ids[container.kind_token];
if (empty_field and (kind == .Keyword_struct or (kind == .Keyword_union and container.init_arg_expr == .None))) {
if (kind == .Keyword_struct or (kind == .Keyword_union and container.init_arg_expr == .None)) {
continue;
}
if (!std.mem.eql(u8, name, "_")) {
(try enum_completions.addOne(allocator)).* = .{
.label = name,
.kind = .Constant,
@ -2058,6 +2059,7 @@ fn makeScopeInternal(
};
}
}
}
if (try scopes.items[scope_idx].decls.fetchPut(name, .{ .ast_node = decl })) |existing| {
// TODO Record a redefinition error.