diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index 4d1e65b32..bffb7d6cf 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -572,7 +572,7 @@ typedef struct Decl *decl; TypeInfo *type_info; }; -} TypedefDecl; +} TypeAliasDecl; typedef struct { @@ -681,7 +681,7 @@ typedef struct Decl_ ImportDecl import; IncludeDecl include; LabelDecl label; - TypedefDecl typedef_decl; + TypeAliasDecl type_alias_decl; VarDecl var; }; } Decl; diff --git a/src/compiler/copying.c b/src/compiler/copying.c index 09fa88a0d..56421ffef 100644 --- a/src/compiler/copying.c +++ b/src/compiler/copying.c @@ -1071,12 +1071,12 @@ Decl *copy_decl(CopyStruct *c, Decl *decl) break; case DECL_TYPEDEF: copy_decl_type(copy); - if (copy->typedef_decl.is_func) + if (copy->type_alias_decl.is_func) { - MACRO_COPY_DECL(copy->typedef_decl.decl); + MACRO_COPY_DECL(copy->type_alias_decl.decl); break; } - MACRO_COPY_TYPE(copy->typedef_decl.type_info); + MACRO_COPY_TYPE(copy->type_alias_decl.type_info); break; case DECL_DISTINCT: copy_decl_type(copy); diff --git a/src/compiler/llvm_codegen.c b/src/compiler/llvm_codegen.c index 47e8b6599..a03ae56f6 100644 --- a/src/compiler/llvm_codegen.c +++ b/src/compiler/llvm_codegen.c @@ -989,7 +989,7 @@ static void llvm_emit_type_decls(GenContext *context, Decl *decl) case DECL_FNTYPE: UNREACHABLE; case DECL_TYPEDEF: - if (decl->typedef_decl.is_func) + if (decl->type_alias_decl.is_func) { REMINDER("Emit func typeid"); } diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index 97277e95c..4826d3329 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -2091,9 +2091,9 @@ static inline Decl *parse_alias_type(ParseContext *c) { decl->decl_kind = DECL_TYPEDEF; decl_add_type(decl, TYPE_TYPEDEF); - decl->typedef_decl.is_func = true; + decl->type_alias_decl.is_func = true; Decl *decl_type = decl_new(DECL_FNTYPE, decl->name, c->prev_span); - decl->typedef_decl.decl = decl_type; + decl->type_alias_decl.decl = decl_type; ASSIGN_TYPE_OR_RET(TypeInfo *type_info, parse_optional_type(c), poisoned_decl); decl_type->fntype_decl.rtype = type_infoid(type_info); if (!parse_fn_parameter_list(c, &(decl_type->fntype_decl))) @@ -2132,14 +2132,14 @@ static inline Decl *parse_alias_type(ParseContext *c) } ASSERT(!tok_is(c, TOKEN_LBRACE)); - decl->typedef_decl.type_info = type_info; - decl->typedef_decl.is_func = false; + decl->type_alias_decl.type_info = type_info; + decl->type_alias_decl.is_func = false; decl->decl_kind = DECL_TYPEDEF; decl_add_type(decl, TYPE_TYPEDEF); if (type_info->kind == TYPE_INFO_IDENTIFIER && type_info->resolve_status == RESOLVE_NOT_DONE && type_info->unresolved.name == decl->name) { - decl->typedef_decl.is_redef = true; + decl->type_alias_decl.is_redef = true; } RANGE_EXTEND_PREV(decl); diff --git a/src/compiler/sema_decls.c b/src/compiler/sema_decls.c index 89d6f777d..e6d8856af 100755 --- a/src/compiler/sema_decls.c +++ b/src/compiler/sema_decls.c @@ -1432,16 +1432,16 @@ static inline bool sema_analyse_typedef(SemaContext *context, Decl *decl, bool * if (*erase_decl) return true; bool is_export = decl->is_export; - if (decl->typedef_decl.is_func) + if (decl->type_alias_decl.is_func) { - Decl *fn_decl = decl->typedef_decl.decl; + Decl *fn_decl = decl->type_alias_decl.decl; fn_decl->is_export = is_export; fn_decl->unit = decl->unit; fn_decl->type = type_new_func(fn_decl, &fn_decl->fntype_decl); decl->type->canonical = type_get_func_ptr(fn_decl->type); return true; } - TypeInfo *info = decl->typedef_decl.type_info; + TypeInfo *info = decl->type_alias_decl.type_info; info->in_def = true; if (!sema_resolve_type_info(context, info, RESOLVE_TYPE_DEFAULT)) return false; decl->type->canonical = info->type->canonical; @@ -3336,7 +3336,7 @@ static bool sema_analyse_attribute(SemaContext *context, ResolvedAttrData *attr_ if (domain == ATTR_ALIAS) { if (decl->decl_kind != DECL_TYPEDEF) RETURN_SEMA_ERROR(attr, "'@weak' can only be used on type aliases."); - if (!decl->typedef_decl.is_redef) + if (!decl->type_alias_decl.is_redef) { RETURN_SEMA_ERROR(attr, "'@weak' is only allowed on type aliases with the same name, eg 'def Foo = bar::def::Foo @weak'."); } @@ -4695,7 +4695,7 @@ static Module *module_instantiate_generic(SemaContext *context, Module *module, Decl *decl = decl_new_with_type(param_name, params[i]->span, DECL_TYPEDEF); decl->resolve_status = RESOLVE_DONE; ASSERT(type_info->resolve_status == RESOLVE_DONE); - decl->typedef_decl.type_info = type_info; + decl->type_alias_decl.type_info = type_info; decl->type->name = decl->name; decl->type->canonical = type_info->type->canonical; params_decls[decls++] = decl; diff --git a/src/compiler/sema_name_resolution.c b/src/compiler/sema_name_resolution.c index a089c5a43..b6db780c6 100644 --- a/src/compiler/sema_name_resolution.c +++ b/src/compiler/sema_name_resolution.c @@ -273,7 +273,7 @@ INLINE Type *sema_fold_weak(SemaContext *context, Decl *decl) { if (!sema_analyse_decl(context, decl)) return NULL; } - Type *type = decl->typedef_decl.type_info->type; + Type *type = decl->type_alias_decl.type_info->type; if (type->type_kind != TYPE_TYPEDEF) return type; decl = type->decl; } diff --git a/src/compiler/sema_types.c b/src/compiler/sema_types.c index 0eb25ed96..3cafb329d 100644 --- a/src/compiler/sema_types.c +++ b/src/compiler/sema_types.c @@ -425,8 +425,8 @@ bool sema_unresolved_type_is_generic(SemaContext *context, TypeInfo *type_info) if (!decl) return false; if (decl->decl_kind != DECL_TYPEDEF) return false; if (decl->resolve_status == RESOLVE_DONE) return false; - if (decl->typedef_decl.is_func) return false; - type_info = decl->typedef_decl.type_info; + if (decl->type_alias_decl.is_func) return false; + type_info = decl->type_alias_decl.type_info; goto RETRY; } diff --git a/src/compiler/types.c b/src/compiler/types.c index 1e87de8a4..f1ccc493e 100644 --- a/src/compiler/types.c +++ b/src/compiler/types.c @@ -1278,7 +1278,7 @@ static void type_create_alias(const char *name, Type *location, Type *canonical) { Decl *decl = decl_new(DECL_TYPEDEF, name, INVALID_SPAN); decl->resolve_status = RESOLVE_DONE; - decl->typedef_decl.type_info = type_info_new_base(canonical, INVALID_SPAN); + decl->type_alias_decl.type_info = type_info_new_base(canonical, INVALID_SPAN); decl->unit = compiler.context.core_unit; decl->is_export = true; *location = (Type) {