mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Support struct field tags in odin doc format
This commit is contained in:
@@ -11,7 +11,7 @@ String :: distinct Array(byte)
|
|||||||
|
|
||||||
Version_Type_Major :: 0
|
Version_Type_Major :: 0
|
||||||
Version_Type_Minor :: 2
|
Version_Type_Minor :: 2
|
||||||
Version_Type_Patch :: 1
|
Version_Type_Patch :: 2
|
||||||
|
|
||||||
Version_Type :: struct {
|
Version_Type :: struct {
|
||||||
major, minor, patch: u8,
|
major, minor, patch: u8,
|
||||||
@@ -242,6 +242,8 @@ Type :: struct {
|
|||||||
polymorphic_params: Type_Index,
|
polymorphic_params: Type_Index,
|
||||||
// Used By: .Struct, .Union
|
// Used By: .Struct, .Union
|
||||||
where_clauses: Array(String),
|
where_clauses: Array(String),
|
||||||
|
// Used By: .Struct
|
||||||
|
tags: Array(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
Type_Flags_Basic :: distinct bit_set[Type_Flag_Basic; u32le]
|
Type_Flags_Basic :: distinct bit_set[Type_Flag_Basic; u32le]
|
||||||
|
|||||||
+2
-1
@@ -15,7 +15,7 @@ struct OdinDocVersionType {
|
|||||||
|
|
||||||
#define OdinDocVersionType_Major 0
|
#define OdinDocVersionType_Major 0
|
||||||
#define OdinDocVersionType_Minor 2
|
#define OdinDocVersionType_Minor 2
|
||||||
#define OdinDocVersionType_Patch 1
|
#define OdinDocVersionType_Patch 2
|
||||||
|
|
||||||
struct OdinDocHeaderBase {
|
struct OdinDocHeaderBase {
|
||||||
u8 magic[8];
|
u8 magic[8];
|
||||||
@@ -137,6 +137,7 @@ struct OdinDocType {
|
|||||||
OdinDocArray<OdinDocEntityIndex> entities;
|
OdinDocArray<OdinDocEntityIndex> entities;
|
||||||
OdinDocTypeIndex polmorphic_params;
|
OdinDocTypeIndex polmorphic_params;
|
||||||
OdinDocArray<OdinDocString> where_clauses;
|
OdinDocArray<OdinDocString> where_clauses;
|
||||||
|
OdinDocArray<OdinDocString> tags; // struct field tags
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OdinDocAttribute {
|
struct OdinDocAttribute {
|
||||||
|
|||||||
@@ -598,6 +598,15 @@ OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) {
|
|||||||
}
|
}
|
||||||
doc_type.where_clauses = odin_doc_where_clauses(w, st->where_clauses);
|
doc_type.where_clauses = odin_doc_where_clauses(w, st->where_clauses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto tags = array_make<OdinDocString>(heap_allocator(), type->Struct.fields.count);
|
||||||
|
defer (array_free(&tags));
|
||||||
|
|
||||||
|
for_array(i, type->Struct.fields) {
|
||||||
|
tags[i] = odin_doc_write_string(w, type->Struct.tags[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
doc_type.tags = odin_write_slice(w, tags.data, tags.count);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Type_Union:
|
case Type_Union:
|
||||||
|
|||||||
Reference in New Issue
Block a user