Begin changing union syntax

This commit is contained in:
Ginger Bill
2017-02-19 19:55:19 +00:00
parent c0d5237b75
commit a94dfdf21d
6 changed files with 192 additions and 45 deletions
+43
View File
@@ -37,6 +37,7 @@ Calling_Convention :: enum {
FAST = 3,
}
/*
Type_Info :: union {
Named: struct #ordered {
name: string,
@@ -96,6 +97,48 @@ Type_Info :: union {
count: int, // == 0 if dynamic
},
}
*/
Type_Info :: union {
Named{name: string, base: ^Type_Info},
Integer{size: int, signed: bool},
Float{size: int},
String{},
Boolean{},
Any{},
Pointer{
elem: ^Type_Info, // nil -> rawptr
},
Procedure{
params: ^Type_Info, // Type_Info.Tuple
results: ^Type_Info, // Type_Info.Tuple
variadic: bool,
convention: Calling_Convention,
},
Array{
elem: ^Type_Info,
elem_size: int,
count: int,
},
Dynamic_Array{elem: ^Type_Info, elem_size: int},
Slice {elem: ^Type_Info, elem_size: int},
Vector {elem: ^Type_Info, elem_size, count, align: int},
Tuple {using record: Type_Info_Record}, // Only really used for procedures
Struct {using record: Type_Info_Record},
Union {using record: Type_Info_Record},
Raw_Union {using record: Type_Info_Record},
Enum{
base: ^Type_Info,
names: []string,
values: []Type_Info_Enum_Value,
},
Map{
key: ^Type_Info,
value: ^Type_Info,
generated_struct: ^Type_Info,
count: int, // == 0 if dynamic
},
}
// // NOTE(bill): only the ones that are needed (not all types)
// // This will be set by the compiler