From: Brendan Hansen Date: Sat, 20 Jan 2024 16:24:26 +0000 (-0600) Subject: cleaned: removed old ast flag that was unused X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=160166282836a57f875d203da3703cbff169635e;p=onyx.git cleaned: removed old ast flag that was unused --- diff --git a/compiler/include/astnodes.h b/compiler/include/astnodes.h index 3f9286e5..6ac93721 100644 --- a/compiler/include/astnodes.h +++ b/compiler/include/astnodes.h @@ -263,9 +263,6 @@ typedef enum AstFlags { Ast_Flag_Private_Package = BH_BIT(3), Ast_Flag_Private_File = BH_BIT(4), - // Function flags - Ast_Flag_Function_Used = BH_BIT(5), - // Expression flags Ast_Flag_Expr_Ignored = BH_BIT(6), Ast_Flag_Address_Taken = BH_BIT(7), diff --git a/compiler/src/astnodes.c b/compiler/src/astnodes.c index 90efc63e..ea6ed878 100644 --- a/compiler/src/astnodes.c +++ b/compiler/src/astnodes.c @@ -709,10 +709,6 @@ TypeMatch unify_node_and_type_(AstTyped** pnode, Type* type, b32 permanent) { if (func == NULL) return TYPE_MATCH_FAILED; if (func == (AstTyped *) &node_that_signals_a_yield) return TYPE_MATCH_YIELD; - // HACK: It feels like there should be a better place to flag that a procedure was definitely used. - if (func->kind == Ast_Kind_Function) - func->flags |= Ast_Flag_Function_Used; - if (permanent) { ensure_overload_returns_correct_type(func, (AstOverloadedFunction *) node); *pnode = func; diff --git a/compiler/src/builtins.c b/compiler/src/builtins.c index 805d32ca..4f2024a3 100644 --- a/compiler/src/builtins.c +++ b/compiler/src/builtins.c @@ -546,8 +546,6 @@ void initialize_builtins(bh_allocator a) { onyx_report_error((OnyxFilePos) { 0 }, Error_Critical, "'__closure_block_allocate' procedure not found."); return; } - // HACK - builtin_closure_block_allocate->flags |= Ast_Flag_Function_Used; builtin_link_options_type = (AstType *) symbol_raw_resolve(p->scope, "Link_Options"); diff --git a/compiler/src/checker.c b/compiler/src/checker.c index e1ba37ce..cb1c56a5 100644 --- a/compiler/src/checker.c +++ b/compiler/src/checker.c @@ -917,7 +917,6 @@ CheckStatus check_call(AstCall** pcall) { if (tm == TYPE_MATCH_YIELD) YIELD(call->token->pos, "Waiting on argument type checking."); call->flags |= Ast_Flag_Has_Been_Checked; - callee->flags |= Ast_Flag_Function_Used; if (call->kind == Ast_Kind_Call && call->callee->kind == Ast_Kind_Macro) { expand_macro(pcall, callee); @@ -2404,7 +2403,6 @@ CheckStatus check_expression(AstTyped** pexpr) { if (expr->type == NULL) YIELD(expr->token->pos, "Waiting for function type to be resolved."); - expr->flags |= Ast_Flag_Function_Used; break; case Ast_Kind_Directive_Solidify: @@ -3001,22 +2999,6 @@ CheckStatus check_overloaded_function(AstOverloadedFunction* ofunc) { return Check_Success; } -static void mark_all_functions_used_in_scope(Scope *scope) { - // - // This ensures that all procedures defined inside of a structure are - // not pruned and omitted from the binary. This is because a large - // use-case of procedures in structures is dynamically linking them - // using the type info data. - if (scope) { - fori (i, 0, shlen(scope->symbols)) { - AstNode* node = scope->symbols[i].value; - if (node->kind == Ast_Kind_Function) { - node->flags |= Ast_Flag_Function_Used; - } - } - } -} - CheckStatus check_meta_tags(bh_arr(AstTyped *) tags) { if (tags) { bh_arr_each(AstTyped *, meta, tags) { @@ -3074,8 +3056,6 @@ CheckStatus check_struct(AstStructType* s_node) { CHECK(constraint_context, &s_node->constraints, s_node->scope, pos); } - mark_all_functions_used_in_scope(s_node->scope); - bh_arr_each(AstStructMember *, smem, s_node->members) { if ((*smem)->type_node != NULL) { CHECK(type, &(*smem)->type_node); @@ -3193,8 +3173,6 @@ CheckStatus check_union(AstUnionType *u_node) { CHECK(constraint_context, &u_node->constraints, u_node->scope, pos); } - mark_all_functions_used_in_scope(u_node->scope); - CHECK(meta_tags, u_node->meta_tags); bh_arr_each(AstUnionVariant *, variant, u_node->variants) { diff --git a/compiler/src/polymorph.h b/compiler/src/polymorph.h index 0e4ce20e..ee3742c9 100644 --- a/compiler/src/polymorph.h +++ b/compiler/src/polymorph.h @@ -110,7 +110,6 @@ static char* build_poly_slns_unique_key(bh_arr(AstPolySolution) slns) { // later. It optionally can start the function header entity at the code generation state if // the header has already been processed. static b32 add_solidified_function_entities(AstSolidifiedFunction *solidified_func) { - solidified_func->func->flags |= Ast_Flag_Function_Used; solidified_func->func->flags |= Ast_Flag_From_Polymorphism; Entity func_header_entity = { diff --git a/core/conv/conv.onyx b/core/conv/conv.onyx index 90f24698..7d583627 100644 --- a/core/conv/conv.onyx +++ b/core/conv/conv.onyx @@ -1,6 +1,8 @@ package core.conv -Enable_Custom_Formatters :: true +#if !#defined(Enable_Custom_Formatters) { + Enable_Custom_Formatters :: true +} use core.string use core.math