diff options
| author | gingerBill <bill@gingerbill.org> | 2022-01-24 14:47:33 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-01-24 14:47:33 +0000 |
| commit | 2554c72bb219286825ee8d47a2c6c748416acb0e (patch) | |
| tree | 21abdc2a6e9fe30d9f6804ef04ae36b7609a4b04 /src/check_type.cpp | |
| parent | 49872e40dcd88f6b011a79baccdadf509f062795 (diff) | |
Update CommentGroup parsing for struct types
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index a5a757f3e..2a7479d68 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -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] == '`')) { |