Compiling and testing multiple files

This commit is contained in:
Krzosa Karol
2022-06-27 14:01:22 +02:00
parent 7b343ca642
commit a363a5e982
4 changed files with 62 additions and 31 deletions

View File

@@ -21,30 +21,32 @@ main :: (): int
else;; assert(false, "We expected S64 here! What a boomer!")
//
// @todo: This should work
//
// any_thing: Any = 10
// _gcvt :: #foreign (value: F64, digits: int, buffer: *char): *char
// print_float :: (value: F64)
// buff: [100]char
// _gcvt(value, 10, &buff[0])
// OutputDebugStringA(&buff[0])
//
// Any type allows us to combine a value pointer and
// it's corresponding type_id
//
value_to_be_wrapped := 10
any_value: Any = value_to_be_wrapped
if any_value.type == S64
// Void pointers get implicitly cast
value: *S64 = any_value.data
*value = 20
elif any_value.type == int
value: *int = any_value.data
*value = 30
elif any_value.type == char;; assert(false, "No bueno")
assert(value_to_be_wrapped == 20)
// print_type :: (t: Type)
// type_info := get_type_info(t)
// if !type_info
// return
// switch type_info.kind
// Type_Info_Kind.S64, Type_Info_Kind.S32, Type_Info_Kind.S16, Type_Info_Kind.S8, Type_Info_Kind.INT
// OutputDebugStringA("Integer")
// Type_Info_Kind.U64, Type_Info_Kind.U32, Type_Info_Kind.U16, Type_Info_Kind.U8
// OutputDebugStringA("Unsigned")
// Type_Info_Kind.F64, Type_Info_Kind.F32
// OutputDebugStringA("Float")
// Type_Info_Kind.POINTER
// OutputDebugStringA("*")
// print_type(type_info.base_type)
// default;; OutputDebugStringA("Unknown")
// print :: (a: Any)
// type_info := get_type_info(a.type)