Preparing to add a module folder
This commit is contained in:
21
parsing.cpp
21
parsing.cpp
@@ -712,14 +712,27 @@ add_implicit_import(Ast_Scope *scope, Ast_Scope *add){
|
||||
}
|
||||
}
|
||||
|
||||
enum{
|
||||
GLOBAL_IMPLICIT_LOAD = 1
|
||||
};
|
||||
function String
|
||||
find_module(Intern_String filename){
|
||||
Scratch scratch;
|
||||
For(pctx->module_folders){
|
||||
String path = string_fmt(scratch, "%Q/%Q", it, filename);
|
||||
if(os_does_file_exist(path)){
|
||||
String result = string_copy(pctx->perm, path);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
enum{ GLOBAL_IMPLICIT_LOAD = 1 };
|
||||
|
||||
function Ast_File *
|
||||
register_ast_file(Token *pos, Intern_String filename, Ast_Module *module, B32 global_implicit_load){
|
||||
String absolute_path = find_module(filename);
|
||||
if(absolute_path.len == 0) absolute_path = os_get_absolute_path(pctx->perm, filename.s);
|
||||
Ast_File *file = 0;
|
||||
String absolute_path = os_get_absolute_path(pctx->perm, filename.s);
|
||||
|
||||
For(pctx->files){
|
||||
if(string_compare(it->absolute_path, absolute_path)){
|
||||
|
||||
Reference in New Issue
Block a user