Getting rid of globals
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
|
||||
CORE_Static void
|
||||
core_init_compiler(Core_Ctx *ctx, Allocator *allocator) {
|
||||
ctx->emit_type_info = true;
|
||||
ctx->emit_line_directives = true;
|
||||
ctx->color_codes_enabled = true;
|
||||
ctx->same_scope_token = { SAME_SCOPE };
|
||||
|
||||
ctx->init_ctx_time_begin = os_time();
|
||||
pctx = ctx;
|
||||
ctx->perm_push_only = make_push_arena(allocator);
|
||||
@@ -240,21 +245,21 @@ compile_file_to_string(Allocator *allocator, String filename) {
|
||||
}
|
||||
|
||||
{
|
||||
Ast_Scope *scope = ast_decl_scope(&null_token, pctx->perm, get(&module->all_loaded_files, 0));
|
||||
Ast_Decl * decl = ast_namespace(&null_token, scope, pctx->intern("Const"_s));
|
||||
Ast_Scope *scope = ast_decl_scope(&pctx->null_token, pctx->perm, get(&module->all_loaded_files, 0));
|
||||
Ast_Decl * decl = ast_namespace(&pctx->null_token, scope, pctx->intern("Const"_s));
|
||||
decl->state = DECL_RESOLVED;
|
||||
|
||||
Value v1 = {};
|
||||
v1.type = untyped_string;
|
||||
v1.intern_val = pctx->intern(OS_NAME);
|
||||
Ast_Decl *const_os1 = ast_const(&null_token, pctx->intern("OSName"_s), v1);
|
||||
Ast_Decl *const_os1 = ast_const(&pctx->null_token, pctx->intern("OSName"_s), v1);
|
||||
const_os1->state = DECL_RESOLVED;
|
||||
insert_into_scope(scope, const_os1);
|
||||
|
||||
Value v2 = {};
|
||||
v1.type = untyped_string;
|
||||
v1.intern_val = pctx->intern(OS_NAME_LOWER);
|
||||
Ast_Decl *const_os2 = ast_const(&null_token, pctx->intern("OSNameLower"_s), v2);
|
||||
Ast_Decl *const_os2 = ast_const(&pctx->null_token, pctx->intern("OSNameLower"_s), v2);
|
||||
const_os2->state = DECL_RESOLVED;
|
||||
insert_into_scope(scope, const_os2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user