diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-01-24 16:58:39 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-01-24 16:58:39 +0100 |
| commit | 6a7d821fcc42e58bb90b78f484c70dfa42a56c91 (patch) | |
| tree | 1d5eede5f6831754489e9ed9677fa9d0006c40df /src/check_type.cpp | |
| parent | 01e29bf27ef0204f586b856363f7a3bf5138052d (diff) | |
| parent | 42ab882db4a6d5765c68021ade010b468ff4531e (diff) | |
Merge remote-tracking branch 'upstream/master' into parser-fix
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] == '`')) { |