Moving more code to list
This commit is contained in:
@@ -726,15 +726,16 @@ function Ast_File *
|
||||
register_ast_file(Token *pos, String absolute_file_path, Ast_Module *module, B32 global_implicit_load){
|
||||
Ast_File *file = 0;
|
||||
|
||||
For(pctx->files){
|
||||
if(string_compare(it->absolute_file_path, absolute_file_path)){
|
||||
if(module == it->module){
|
||||
Iter(&pctx->files){
|
||||
Ast_File *it_file = it.item[0];
|
||||
if(string_compare(it_file->absolute_file_path, absolute_file_path)){
|
||||
if(module == it_file->module){
|
||||
log_trace("%Q :: Returning registered file: %Q\n", module->absolute_file_path, absolute_file_path);
|
||||
file = it;
|
||||
file = it_file;
|
||||
break;
|
||||
}
|
||||
|
||||
compiler_error(it->pos, pos, "This file is already loaded by module: %Q, try importing that module to get access to it", module->absolute_file_path);
|
||||
compiler_error(it_file->pos, pos, "This file is already loaded by module: %Q, try importing that module to get access to it", module->absolute_file_path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,9 +751,9 @@ register_ast_file(Token *pos, String absolute_file_path, Ast_Module *module, B32
|
||||
file->implicit_imports = {pctx->heap};
|
||||
file->pos = pos;
|
||||
file->debug_name = string_skip_to_last_slash(absolute_file_path);
|
||||
add(pctx->perm_arena, &file->module->all_loaded_files, file);
|
||||
add(pctx->perm, &file->module->all_loaded_files, file);
|
||||
file->scope_id = pctx->scope_ids++;
|
||||
pctx->files.add(file);
|
||||
add(pctx->perm, &pctx->files, file);
|
||||
}
|
||||
|
||||
if(global_implicit_load) {
|
||||
|
||||
Reference in New Issue
Block a user