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;
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);
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:
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) {
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);
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) {
// 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 = {