Update CommentGroup parsing for struct types

This commit is contained in:
gingerBill
2022-01-24 14:47:33 +00:00
parent 49872e40dc
commit 2554c72bb2
5 changed files with 21 additions and 3 deletions
+10
View File
@@ -120,6 +120,8 @@ void check_struct_fields(CheckerContext *ctx, Ast *node, Slice<Entity *> *fields
ast_node(p, Field, param);
Ast *type_expr = p->type;
Type *type = nullptr;
CommentGroup *docs = p->docs;
CommentGroup *comment = p->comment;
if (type_expr != nullptr) {
type = check_type_expr(ctx, type_expr, nullptr);
@@ -156,6 +158,14 @@ void check_struct_fields(CheckerContext *ctx, Ast *node, Slice<Entity *> *fields
Entity *field = alloc_entity_field(ctx->scope, name_token, type, is_using, field_src_index);
add_entity(ctx, ctx->scope, name, field);
field->Variable.field_group_index = field_group_index;
if (j == 0) {
field->Variable.docs = docs;
}
if (j+1 == p->names.count) {
field->Variable.comment = comment;
}
array_add(&fields_array, field);
String tag = p->tag.string;
if (tag.len != 0 && !unquote_string(permanent_allocator(), &tag, 0, tag.text[0] == '`')) {