Remove one of implicit arrays and still working
This commit is contained in:
4
ast.cpp
4
ast.cpp
@@ -200,8 +200,7 @@ enum Ast_Decl_State{
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Ast_Scope: Ast{
|
struct Ast_Scope: Ast{
|
||||||
Array<Ast_Module *> implicit_imports;
|
Array<Ast_Scope *> implicit_imports;
|
||||||
Array<Ast_File *> implicit_loads;
|
|
||||||
Array<Ast_Decl *> decls;
|
Array<Ast_Decl *> decls;
|
||||||
Array<Ast *> stmts;
|
Array<Ast *> stmts;
|
||||||
|
|
||||||
@@ -526,7 +525,6 @@ ast_module(Intern_String filename){
|
|||||||
result->module = result;
|
result->module = result;
|
||||||
result->file = result;
|
result->file = result;
|
||||||
result->all_loaded_files = {pctx->heap};
|
result->all_loaded_files = {pctx->heap};
|
||||||
result->implicit_loads = {pctx->heap};
|
|
||||||
result->implicit_imports = {pctx->heap};
|
result->implicit_imports = {pctx->heap};
|
||||||
result->decls = {pctx->heap};
|
result->decls = {pctx->heap};
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
lambdas :: #load "lambdas.kl"
|
lambdas :: #load "lambdas.kl"
|
||||||
Memory :: #load "enums.kl"
|
Memory :: #load "enums.kl"
|
||||||
#import "order1.kl"
|
#import "order1.kl"
|
||||||
|
order :: #import "order1.kl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -8,6 +9,8 @@ test_load :: ()
|
|||||||
new_types :: #load "new_types.kl"
|
new_types :: #load "new_types.kl"
|
||||||
new_types.basic_type_assignment()
|
new_types.basic_type_assignment()
|
||||||
arena__: order2.Arena
|
arena__: order2.Arena
|
||||||
|
Arena_ :: order.order2.Arena
|
||||||
|
arena___: Arena_
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Function types
|
// Function types
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
Test :: struct
|
Test :: struct
|
||||||
len: S64
|
len: S64
|
||||||
|
|
||||||
|
|
||||||
test: Test
|
test: Test
|
||||||
member := test.len
|
member := test.len
|
||||||
|
|
||||||
|
|||||||
@@ -599,14 +599,13 @@ register_ast_file(Intern_String filename, Ast_Module *module, B32 global_implici
|
|||||||
file->module = module;
|
file->module = module;
|
||||||
file->file = file; // @warning: self referential!
|
file->file = file; // @warning: self referential!
|
||||||
file->decls = {pctx->heap};
|
file->decls = {pctx->heap};
|
||||||
file->implicit_loads = {pctx->heap};
|
|
||||||
file->implicit_imports = {pctx->heap};
|
file->implicit_imports = {pctx->heap};
|
||||||
file->module->all_loaded_files.add(file);
|
file->module->all_loaded_files.add(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(global_implicit_load) {
|
if(global_implicit_load) {
|
||||||
file->global_implicit_load = true;
|
file->global_implicit_load = true;
|
||||||
module->implicit_loads.add(file);
|
module->implicit_imports.add(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
|
|||||||
@@ -320,11 +320,6 @@ _search_for_decl(Ast_Scope *scope, Intern_String name){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
For(scope->implicit_loads){
|
|
||||||
Ast_Decl *result = _search_for_decl(it, name);
|
|
||||||
if(result) return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
For(scope->implicit_imports){
|
For(scope->implicit_imports){
|
||||||
Ast_Decl *result = _search_for_decl(it, name);
|
Ast_Decl *result = _search_for_decl(it, name);
|
||||||
if(result) return result;
|
if(result) return result;
|
||||||
@@ -909,7 +904,8 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_context){
|
|||||||
|
|
||||||
function void
|
function void
|
||||||
resolve_decl(Ast_Decl *ast){
|
resolve_decl(Ast_Decl *ast){
|
||||||
if(ast->state == DECL_RESOLVED) return;
|
if(ast->state == DECL_RESOLVED)
|
||||||
|
return;
|
||||||
else if(ast->state == DECL_RESOLVING){
|
else if(ast->state == DECL_RESOLVING){
|
||||||
compiler_error(ast->pos, "Cyclic dependency of %s", ast->name.str);
|
compiler_error(ast->pos, "Cyclic dependency of %s", ast->name.str);
|
||||||
return;
|
return;
|
||||||
@@ -965,11 +961,7 @@ resolve_decl(Ast_Decl *ast){
|
|||||||
BREAK();
|
BREAK();
|
||||||
}
|
}
|
||||||
|
|
||||||
case AST_MODULE_NAMESPACE:
|
case AST_MODULE_NAMESPACE: CASE(FILE_NAMESPACE, File_Namespace){unused(node);BREAK();}
|
||||||
CASE(FILE_NAMESPACE, File_Namespace){
|
|
||||||
unused(node);
|
|
||||||
BREAK();
|
|
||||||
}
|
|
||||||
|
|
||||||
CASE(ENUM, Decl){
|
CASE(ENUM, Decl){
|
||||||
Ast_Type *type_of_enum = resolve_typespec(node->typespec, AST_CAN_BE_NULL);
|
Ast_Type *type_of_enum = resolve_typespec(node->typespec, AST_CAN_BE_NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user