Cleanup + little polymorph + ast_copy

This commit is contained in:
Krzosa Karol
2023-03-31 08:19:26 +02:00
parent 21c8ceff03
commit aaf1b2f2d9
11 changed files with 406 additions and 15 deletions

View File

@@ -76,6 +76,15 @@ arena_push_size(Arena *a, size_t size) {
return result;
}
#define push_struct_copy(a, T, p) (T *)push_copy(a, p, sizeof(T))
CORE_Static void *
push_copy(Arena *a, void *p, size_t size) {
if (p == 0) return 0;
void *result = arena_push_size(a, size);
memory_copy(result, p, size);
return result;
}
CORE_Static Arena
push_arena(Allocator *allocator, size_t size, String debug_name) {
Arena result = {};