Module changes, found Type_Incomplete error

This commit is contained in:
Krzosa Karol
2022-10-14 17:20:46 +02:00
parent a60df75cc3
commit e07ad3c86d
7 changed files with 59 additions and 15 deletions

View File

@@ -16,7 +16,14 @@ Init :: (a: *Arena)
a.memory = OS.Reserve(DEFAULT_RESERVE_SIZE)
a.alignment = DEFAULT_ALIGNMENT
a.di = ArenaDI++
// a.allocator.proc = arena_allocator_proc
FromBuffer :: (buffer: []U8): Arena
a: Arena
a.memory.reserve = Len(buffer)->U64
a.memory.commit = Len(buffer)->U64
a.alignment = DEFAULT_ALIGNMENT
a.di = ArenaDI++
return a
PushSize :: (a: *Arena, size: Base.SizeU): *void
generous_size := size + a.alignment
@@ -31,15 +38,5 @@ PushSize :: (a: *Arena, size: Base.SizeU): *void
a.len += size
return result
// @todo: Make this compile time thing!!!
// This probably will wait till polymorphism stuff
// something like this:
// PushType :: (a: *Arena, type: $T): *T
//
PushType :: (a: *Arena, type: Type): *void
type_info := get_type_info(type)
Assert(type_info != 0)
return PushSize(a, type_info.size->Base.SizeU)
Release :: (a: *Arena)
OS.Release(&a.memory)