void pointer duck typing

This commit is contained in:
Krzosa Karol
2022-06-17 09:16:33 +02:00
parent 66d7c8ca52
commit ed017c79a5
9 changed files with 68 additions and 38 deletions

View File

@@ -680,10 +680,13 @@ parse_all_modules(){
function Ast_Module *
add_module(Intern_String filename){
For(pctx->modules){
if(it->name == filename)
if(it->name == filename){
log_info("Returning registered module: %Q\n", filename);
return it;
}
}
log_info("Adding module: %Q\n", filename);
Ast_Module *result = ast_module(filename);
register_ast_file(result->name, result, true);
pctx->modules.add(result);
@@ -722,7 +725,7 @@ begin_compilation(){
global F64 generating_time_begin;
global F64 generating_time_end;
function String
end_compilation(){
get_compilation_result(){
generating_time_begin = os_time();
#if 1
@@ -806,7 +809,11 @@ typedef struct String{
}
String string_result = string_flatten(pctx->perm, &pctx->gen);
exp_destroy(pctx->heap);
generating_time_end = os_time();
return string_result;
}
function void
compiler_cleanup(){
exp_destroy(pctx->heap);
}