From 015332b69e2cc6a073c33ca85acff2f587665c86 Mon Sep 17 00:00:00 2001 From: nullptrdevs <16590917+nullptrdevs@users.noreply.github.com> Date: Mon, 22 Aug 2022 10:54:29 -0700 Subject: [PATCH] Update analysis.zig --- src/analysis.zig | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/analysis.zig b/src/analysis.zig index cad359a..540f52c 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -2542,17 +2542,21 @@ fn makeInnerScope(allocator: std.mem.Allocator, context: ScopeContext, node_idx: }; if (container_field) |_| { - if (!std.mem.eql(u8, name, "_") and !std.mem.eql(u8, name, "other")) { - try context.enums.put(allocator, .{ + if (!std.mem.eql(u8, name, "_")) { + var doc = if (try getDocComments(allocator, tree, decl, .Markdown)) |docs| + types.MarkupContent{ .kind = .Markdown, .value = docs } + else + null; + var gop_res = try context.enums.getOrPut(allocator, .{ .label = name, .kind = .Constant, .insertText = name, .insertTextFormat = .PlainText, - .documentation = if (try getDocComments(allocator, tree, decl, .Markdown)) |docs| - types.MarkupContent{ .kind = .Markdown, .value = docs } - else - null, - }, {}); + .documentation = doc + }); + if (gop_res.found_existing) { + if (doc) |d| allocator.free(d.value); + } } } }