Merge pull request #7289 from Znarf64/enum-value-init-doc

Use enum value init expression instead of numeric value in doc format
This commit is contained in:
gingerBill
2026-08-11 21:44:32 +02:00
committed by GitHub
3 changed files with 5 additions and 0 deletions

View File

@@ -1009,6 +1009,7 @@ gb_internal void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *nam
e->Constant.flags |= entity_flags;
e->Constant.docs = docs;
e->Constant.comment = comment;
e->Constant.init_expr = init;
auto interned = entity_interned_name(e);

View File

@@ -890,6 +890,9 @@ gb_internal OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e)
}
break;
case Entity_Constant:
if (init_expr == nullptr) {
init_expr = e->Constant.init_expr;
}
field_group_index = e->Constant.field_group_index;
break;
case Entity_Procedure:

View File

@@ -205,6 +205,7 @@ struct Entity {
i32 field_group_index;
CommentGroup *docs;
CommentGroup *comment;
Ast *init_expr; // only used for enum values
} Constant;
struct {
Ast *type_expr; // only used for some variables within procedure bodies