mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-14 02:25:49 +00:00
Add generic count of arrays to to doc-format
This commit is contained in:
@@ -472,6 +472,14 @@ gb_internal OdinDocArray<OdinDocTypeIndex> odin_doc_type_as_slice(OdinDocWriter
|
||||
return odin_write_item_as_slice(w, index);
|
||||
}
|
||||
|
||||
gb_internal OdinDocArray<OdinDocTypeIndex> odin_doc_type2_as_slice(OdinDocWriter *w, Type *type0, Type *type1, bool cache=true) {
|
||||
OdinDocTypeIndex indices[2] = {};
|
||||
indices[0] = odin_doc_type(w, type0, cache);
|
||||
indices[1] = odin_doc_type(w, type1, cache);
|
||||
|
||||
return odin_write_slice(w, indices, gb_count_of(indices));
|
||||
}
|
||||
|
||||
gb_internal OdinDocArray<OdinDocEntityIndex> odin_doc_add_entity_as_slice(OdinDocWriter *w, Entity *e) {
|
||||
OdinDocEntityIndex index = odin_doc_add_entity(w, e);
|
||||
return odin_write_item_as_slice(w, index);
|
||||
@@ -555,7 +563,13 @@ gb_internal OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type, bool ca
|
||||
doc_type.kind = OdinDocType_Array;
|
||||
doc_type.elem_count_len = 1;
|
||||
doc_type.elem_counts[0] = type->Array.count;
|
||||
doc_type.types = odin_doc_type_as_slice(w, type->Array.elem);
|
||||
if (type->Array.generic_count != nullptr) {
|
||||
doc_type.types = odin_doc_type2_as_slice(w,
|
||||
type->Array.elem,
|
||||
type->Array.generic_count);
|
||||
} else {
|
||||
doc_type.types = odin_doc_type_as_slice(w, type->Array.elem);
|
||||
}
|
||||
break;
|
||||
case Type_EnumeratedArray:
|
||||
doc_type.kind = OdinDocType_EnumeratedArray;
|
||||
@@ -580,7 +594,15 @@ gb_internal OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type, bool ca
|
||||
doc_type.kind = OdinDocType_FixedCapacityDynamicArray;
|
||||
doc_type.elem_count_len = 1;
|
||||
doc_type.elem_counts[0] = type->FixedCapacityDynamicArray.capacity;
|
||||
doc_type.types = odin_doc_type_as_slice(w, type->FixedCapacityDynamicArray.elem);
|
||||
|
||||
if (type->FixedCapacityDynamicArray.generic_capacity != nullptr) {
|
||||
doc_type.types = odin_doc_type2_as_slice(w,
|
||||
type->FixedCapacityDynamicArray.elem,
|
||||
type->FixedCapacityDynamicArray.generic_capacity);
|
||||
|
||||
} else {
|
||||
doc_type.types = odin_doc_type_as_slice(w, type->FixedCapacityDynamicArray.elem);
|
||||
}
|
||||
break;
|
||||
case Type_Map:
|
||||
doc_type.kind = OdinDocType_Map;
|
||||
|
||||
Reference in New Issue
Block a user