Comments
This commit is contained in:
@@ -23,45 +23,6 @@ destroy_compiler(){
|
||||
exp_destroy(&pctx->stage_arena);
|
||||
}
|
||||
|
||||
function void
|
||||
parse_file(Ast_File *file){
|
||||
assert(file);
|
||||
|
||||
Scratch scratch;
|
||||
file->filecontent = os_read_file(pctx->perm, file->absolute_file_path);
|
||||
if(file->filecontent.len == 0){
|
||||
compiler_error(file->pos, "Failed to open file \"%Q\"", file->absolute_file_path);
|
||||
}
|
||||
|
||||
|
||||
pctx->currently_parsed_file = file;
|
||||
pctx->currently_parsed_scope = file;
|
||||
lex_restream(pctx, file->filecontent, file->absolute_file_path);
|
||||
while(token_expect(SAME_SCOPE)){
|
||||
if(token_match_pound(pctx->intern("load"_s))){
|
||||
parse_load(true);
|
||||
continue;
|
||||
} else if(token_match_pound(pctx->intern("import"_s))){
|
||||
parse_import(true);
|
||||
continue;
|
||||
}
|
||||
|
||||
Ast_Decl *decl = parse_decl(true);
|
||||
if(!decl) break;
|
||||
|
||||
set_flag(decl->flags, AST_GLOBAL);
|
||||
if(decl->kind == AST_STRUCT){
|
||||
decl->type = type_type;
|
||||
decl->type_val = type_incomplete(decl);
|
||||
decl->state = DECL_RESOLVED;
|
||||
}
|
||||
|
||||
insert_into_scope(file, decl);
|
||||
}
|
||||
pctx->currently_parsed_scope = 0;
|
||||
pctx->currently_parsed_file = 0;
|
||||
}
|
||||
|
||||
function void
|
||||
insert_builtin_into_scope(Ast_Scope *p, String name, Ast_Type *type){
|
||||
Intern_String string = pctx->intern(name);
|
||||
|
||||
Reference in New Issue
Block a user