mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-14 01:34:35 +00:00
Use enum value init expression instead of numeric value in doc format
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user