if (func->entity_header && func->entity_header->state < Entity_State_Code_Gen)
YIELD(func->token->pos, "Waiting for procedure header to pass type-checking");
- bh_arr_each(AstTyped *, pexpr, func->tags) {
- CHECK(expression, pexpr);
-
- if (((*pexpr)->flags & Ast_Flag_Comptime) == 0) {
- ERROR((*pexpr)->token->pos, "#tag expressions should be compile time known.");
- }
- }
-
bh_arr_clear(context.checker.expected_return_type_stack);
bh_arr_push(context.checker.expected_return_type_stack, &func->type->Function.return_type);
}
}
+ bh_arr_each(AstTyped *, pexpr, func->tags) {
+ CHECK(expression, pexpr);
+
+ if (((*pexpr)->flags & Ast_Flag_Comptime) == 0) {
+ ERROR((*pexpr)->token->pos, "#tag expressions should be compile time known.");
+ }
+ }
+
func->type = type_build_function_type(context.ast_alloc, func);
if (func->type == NULL) YIELD(func->token->pos, "Waiting for function type to be constructed");
if (func->deprecated_warning) {
SYMRES(expression, (AstTyped **) &func->deprecated_warning);
}
+
+ bh_arr_each(AstTyped *, pexpr, func->tags) {
+ SYMRES(expression, pexpr);
+ }
if (func->foreign.import_name) {
SYMRES(expression, &func->foreign.module_name);
}
}
- bh_arr_each(AstTyped *, pexpr, func->tags) {
- SYMRES(expression, pexpr);
- }
-
func->flags |= Ast_Flag_Has_Been_Symres;
}
// NOTE: Don't output functions that are not used, only if
// they are also not exported.
if ((fd->flags & Ast_Flag_Function_Used) == 0) {
- if (fd->is_exported || bh_arr_length(fd->tags) > 0) {
+ if (fd->is_exported || (bh_arr_length(fd->tags) > 0 && !fd->is_foreign)) {
return 1;
} else {
return 0;