diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-03 13:41:02 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-03 13:41:11 -0400 |
| commit | 662e8358b79de212a3a2b39d077fd7407a850058 (patch) | |
| tree | ebe1dc03a00ce0594b952e80d5461bb70e6a0973 /src/server/collector.odin | |
| parent | 7c8439ef9ab2243339583a492eac0c867a0b1d4e (diff) | |
Add documentation to union variants
Diffstat (limited to 'src/server/collector.odin')
| -rw-r--r-- | src/server/collector.odin | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/server/collector.odin b/src/server/collector.odin index 37ba74c..c06879d 100644 --- a/src/server/collector.odin +++ b/src/server/collector.odin @@ -247,6 +247,7 @@ collect_union_fields :: proc( collection: ^SymbolCollection, union_type: ast.Union_Type, package_map: map[string]string, + file: ast.File, ) -> SymbolUnionValue { types := make([dynamic]^ast.Expr, 0, collection.allocator) @@ -256,9 +257,15 @@ collect_union_fields :: proc( append(&types, cloned) } + temp_docs, temp_comments := get_field_docs_and_comments(file, union_type.variants, context.temp_allocator) + docs := clone_dynamic_array(temp_docs, collection.allocator, &collection.unique_strings) + comments := clone_dynamic_array(temp_comments, collection.allocator, &collection.unique_strings) + value := SymbolUnionValue { - types = types[:], - poly = cast(^ast.Field_List)clone_type(union_type.poly_params, collection.allocator, &collection.unique_strings), + types = types[:], + poly = cast(^ast.Field_List)clone_type(union_type.poly_params, collection.allocator, &collection.unique_strings), + comments = comments[:], + docs = docs[:], } return value @@ -567,7 +574,7 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri case ^ast.Union_Type: token = v^ token_type = .Union - symbol.value = collect_union_fields(collection, v^, package_map) + symbol.value = collect_union_fields(collection, v^, package_map, file) symbol.signature = "union" case ^ast.Bit_Set_Type: token = v^ |