Add a language.kl module which should contain builtin stuff

This commit is contained in:
Krzosa Karol
2022-06-18 19:42:59 +02:00
parent 649f37cb1b
commit c85fa02750
6 changed files with 102 additions and 78 deletions

View File

@@ -672,21 +672,20 @@ insert_builtin_types_into_scope(Ast_Scope *p){
global F64 parsing_time_begin;
global F64 parsing_time_end;
function void
parse_files(Ast_Module *module){
for(S64 i = 0; i < module->all_loaded_files.len; i++){
auto it = module->all_loaded_files.data[i];
parse_file(it);
}
}
function void
parse_all_modules(){
parsing_time_begin = os_time();
for(S64 i = 0; i < pctx->modules.len; i++){
Ast_Module *it = pctx->modules[i];
parse_files(it);
it->implicit_imports.add(pctx->builtins);
Ast_Module *module = pctx->modules[i];
for(S64 j = 0; j < module->all_loaded_files.len; j++){
Ast_File *file = module->all_loaded_files.data[j];
parse_file(file);
}
if(module != pctx->language_base_module)
module->implicit_imports.add(pctx->language_base_module);
}
parsing_time_end = os_time();
}
@@ -713,11 +712,11 @@ function void
resolve_everything_in_module(Ast_Module *module){
resolving_time_begin = os_time();
for(S64 i = 0; i < module->all_loaded_files.len; i++){
Ast_File *it = module->all_loaded_files[i];
For_Named(it->decls, jt){
resolve_name(it, jt->pos, jt->name);
if(jt->kind == AST_STRUCT){
type_complete(jt->type_val);
Ast_File *file = module->all_loaded_files[i];
For(file->decls){
resolve_name(file, it->pos, it->name);
if(it->kind == AST_STRUCT){
type_complete(it->type_val);
}
}
}
@@ -824,7 +823,7 @@ typedef struct String{
}
}
#if 1
#if 0
gen("Type_Info *type_infos = (Type_Info[]){");
global_indent++;
For(pctx->all_types){