Module relative pathing seems to work, managed to get out of having to have the exe where the files are,
Got rid of scope names, now unique names uses scope ids, module folder is in top folder
This commit is contained in:
11
ast.cpp
11
ast.cpp
@@ -224,11 +224,11 @@ How does current declaration order resolver works:
|
||||
*/
|
||||
|
||||
struct Ast_Scope: Ast{
|
||||
Intern_String name; // for debugging
|
||||
Array<Ast_Scope *> implicit_imports;
|
||||
Array<Ast_Decl *> decls;
|
||||
Array<Ast *> stmts;
|
||||
|
||||
U32 scope_id;
|
||||
Ast_Scope *file; // Self referential for scope and module
|
||||
Ast_Module *module;
|
||||
};
|
||||
@@ -241,13 +241,13 @@ enum Ast_Module_State{
|
||||
|
||||
struct Ast_Module: Ast_Scope{
|
||||
Ast_Module_State state;
|
||||
String base_folder;
|
||||
String absolute_base_folder;
|
||||
String absolute_file_path;
|
||||
Array<Ast_File *> all_loaded_files;
|
||||
};
|
||||
|
||||
struct Ast_File: Ast_Scope{
|
||||
String absolute_path;
|
||||
Intern_String filename;
|
||||
String absolute_file_path;
|
||||
String filecontent;
|
||||
};
|
||||
|
||||
@@ -464,6 +464,7 @@ begin_decl_scope(Allocator *scratch, Token *pos){
|
||||
result->decls = {scratch};
|
||||
result->file = pctx->currently_parsed_file;
|
||||
result->module = pctx->currently_parsed_file->module;
|
||||
result->scope_id = pctx->scope_ids++;
|
||||
assert(result->file);
|
||||
pctx->currently_parsed_scope = result;
|
||||
return result;
|
||||
@@ -482,6 +483,7 @@ begin_stmt_scope(Allocator *scratch, Token *pos){
|
||||
result->decls = {pctx->heap};
|
||||
result->file = pctx->currently_parsed_file;
|
||||
result->module = pctx->currently_parsed_file->module;
|
||||
result->scope_id = pctx->scope_ids++;
|
||||
assert(result->file);
|
||||
pctx->currently_parsed_scope = result;
|
||||
return result;
|
||||
@@ -547,6 +549,7 @@ ast_decl_scope(Token *pos, Allocator *allocator, Ast_File *file){
|
||||
AST_NEW(Scope, SCOPE, pos, AST_DECL);
|
||||
result->decls = {allocator};
|
||||
result->file = file;
|
||||
result->scope_id = pctx->scope_ids++;
|
||||
assert(result->file);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user