aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-02-19 19:55:19 +0000
committerGinger Bill <bill@gingerbill.org>2017-02-19 19:55:19 +0000
commita94dfdf21d798bc72bbee0cc04b80149f0d4b8d2 (patch)
tree3bf491ee4bd397de165a7732eba1bddb5ccb1bad /core
parentc0d5237b75b1ce19ee0e003dcd2dcffa66c442fd (diff)
Begin changing `union` syntax
Diffstat (limited to 'core')
-rw-r--r--core/_preload.odin43
1 files changed, 43 insertions, 0 deletions
diff --git a/core/_preload.odin b/core/_preload.odin
index fe8288bc6..c61049290 100644
--- a/core/_preload.odin
+++ b/core/_preload.odin
@@ -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