Added conditional compilation and Const namespace with OS name

This commit is contained in:
Krzosa Karol
2022-10-08 10:02:50 +02:00
parent ed98572547
commit 15e4ebd682
13 changed files with 201 additions and 129 deletions

View File

@@ -5,8 +5,7 @@
enum Ast_Kind: U32{
AST_NONE,
AST_FILE_NAMESPACE,
AST_MODULE_NAMESPACE,
AST_NAMESPACE,
AST_MODULE,
AST_FILE,
@@ -236,13 +235,13 @@ How does current declaration order resolver works:
struct Ast_Scope: Ast{
String debug_name; // Dont use
List<Ast_Scope *> implicit_imports;
Array<Ast_Decl *> decls;
Array<Ast *> stmts;
List<Ast_Scope *> implicit_imports;
Array<Ast_Decl *> decls;
Array<Ast *> stmts;
U32 visit_id;
U32 scope_id;
Ast_Scope *file; // Self referential for scope and module
Ast_Scope *file; // Self referential for file and module
Ast_Module *module;
};
@@ -569,16 +568,8 @@ ast_decl_scope(Token *pos, Allocator *allocator, Ast_File *file){
}
function Ast_Decl *
ast_file_namespace(Token *pos, Ast_File *file, Intern_String name){
AST_NEW(Decl, FILE_NAMESPACE, pos, AST_DECL);
result->scope = file;
result->name = name;
return result;
}
function Ast_Decl *
ast_module_namespace(Token *pos, Ast_Module *module, Intern_String name){
AST_NEW(Decl, MODULE_NAMESPACE, pos, AST_DECL);
ast_namespace(Token *pos, Ast_Scope *module, Intern_String name){
AST_NEW(Decl, NAMESPACE, pos, AST_DECL);
result->scope = module;
result->name = name;
return result;