More module work

This commit is contained in:
Krzosa Karol
2022-06-13 12:01:28 +02:00
parent b0553c38cf
commit 8bd5e9638f
9 changed files with 127 additions and 122 deletions

17
ast.cpp
View File

@@ -48,7 +48,7 @@ enum{
AST_ATOM = bit_flag(7),
AST_FOREIGN = bit_flag(8),
AST_DECL = bit_flag(9),
AST_FILE_NAMESPACE_LEVEL = bit_flag(10),
AST_GLOBAL = bit_flag(10),
AST_FLAG = bit_flag(11),
};
@@ -205,7 +205,6 @@ struct Ast_Scope: Ast{
struct Ast_Decl: Ast{
Ast_Decl_State state;
// Kind: AST_STRUCT implied AST_DECL (should flag AST_CONST AST_DECL)
Intern_String name;
Ast_Scope *scope;
@@ -218,10 +217,6 @@ struct Ast_Decl: Ast{
INLINE_VALUE_FIELDS;
};
struct Ast_File_Namespace : Ast_Decl{
Ast_File *file;
};
//-----------------------------------------------------------------------------
// AST Constructors beginning with expressions
//-----------------------------------------------------------------------------
@@ -477,19 +472,19 @@ ast_type(Token *pos, Intern_String name, Ast_Type *type){
}
function Ast_Scope *
ast_decl_scope(Token *pos, Allocator *allocator){
ast_decl_scope(Token *pos, Allocator *allocator, Ast_File *file){
AST_NEW(Scope, SCOPE, pos, AST_DECL);
result->decls = {allocator};
result->file = pctx->currently_parsed_file;
result->file = file;
assert(result->file);
return result;
}
function Ast_File_Namespace *
function Ast_Decl *
ast_file_namespace(Token *pos, Ast_File *file, Intern_String name){
AST_NEW(File_Namespace, FILE_NAMESPACE, pos, 0);
AST_NEW(Decl, FILE_NAMESPACE, pos, AST_DECL);
result->kind = AST_FILE_NAMESPACE;
result->file = file;
result->scope = file->scope;
result->name = name;
return result;
}