mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Renaming
This commit is contained in:
@@ -44,7 +44,7 @@ static inline bool sema_analyse_attribute_decl(SemaContext *context, SemaContext
|
||||
static inline bool sema_analyse_type_alias(SemaContext *context, Decl *decl, bool *erase_decl);
|
||||
static bool sema_analyse_variable_type(SemaContext *context, Type *type, SourceSpan span);
|
||||
static inline bool sema_analyse_alias(SemaContext *context, Decl *decl, bool *erase_decl);
|
||||
static inline bool sema_analyse_distinct(SemaContext *context, Decl *decl, bool *erase_decl);
|
||||
static inline bool sema_analyse_typedef(SemaContext *context, Decl *decl, bool *erase_decl);
|
||||
|
||||
static CompilationUnit *unit_copy(Module *module, CompilationUnit *unit);
|
||||
|
||||
@@ -408,9 +408,9 @@ RETRY:;
|
||||
type = type_flatten(type);
|
||||
switch (type->type_kind)
|
||||
{
|
||||
case TYPE_DISTINCT:
|
||||
case TYPE_POISONED:
|
||||
case TYPE_TYPEDEF:
|
||||
case TYPE_POISONED:
|
||||
case TYPE_ALIAS:
|
||||
case TYPE_UNTYPED_LIST:
|
||||
case TYPE_OPTIONAL:
|
||||
case TYPE_WILDCARD:
|
||||
@@ -1022,7 +1022,7 @@ RETRY:
|
||||
case TYPE_STRUCT:
|
||||
case TYPE_UNION:
|
||||
case TYPE_BITSTRUCT:
|
||||
case TYPE_DISTINCT:
|
||||
case TYPE_TYPEDEF:
|
||||
case TYPE_VECTOR:
|
||||
case TYPE_INFERRED_VECTOR:
|
||||
case TYPE_UNTYPED_LIST:
|
||||
@@ -1030,7 +1030,7 @@ RETRY:
|
||||
case TYPE_TYPEINFO:
|
||||
case TYPE_MEMBER:
|
||||
return true;
|
||||
case TYPE_TYPEDEF:
|
||||
case TYPE_ALIAS:
|
||||
type = type->canonical;
|
||||
goto RETRY;
|
||||
case TYPE_POINTER:
|
||||
@@ -1504,10 +1504,10 @@ static inline bool sema_analyse_type_alias(SemaContext *context, Decl *decl, boo
|
||||
/**
|
||||
* Analyse a distinct type.
|
||||
*/
|
||||
static inline bool sema_analyse_distinct(SemaContext *context, Decl *decl, bool *erase_decl)
|
||||
static inline bool sema_analyse_typedef(SemaContext *context, Decl *decl, bool *erase_decl)
|
||||
{
|
||||
// Check the attributes on the distinct type.
|
||||
if (!sema_analyse_attributes(context, decl, decl->attributes, ATTR_DISTINCT, erase_decl)) return false;
|
||||
if (!sema_analyse_attributes(context, decl, decl->attributes, ATTR_TYPEDEF, erase_decl)) return false;
|
||||
|
||||
// Erase it?
|
||||
if (*erase_decl) return true;
|
||||
@@ -2644,10 +2644,10 @@ static inline Decl *sema_find_interface_for_method(SemaContext *context, Canonic
|
||||
{
|
||||
case TYPE_STRUCT:
|
||||
case TYPE_UNION:
|
||||
case TYPE_DISTINCT:
|
||||
case TYPE_TYPEDEF:
|
||||
case TYPE_ENUM:
|
||||
break;
|
||||
case TYPE_TYPEDEF:
|
||||
case TYPE_ALIAS:
|
||||
UNREACHABLE
|
||||
default:
|
||||
return NULL;
|
||||
@@ -2864,7 +2864,7 @@ static inline bool sema_analyse_method(SemaContext *context, Decl *decl)
|
||||
case TYPE_FUNC_RAW:
|
||||
case TYPE_UNTYPED_LIST:
|
||||
case TYPE_BITSTRUCT:
|
||||
case TYPE_DISTINCT:
|
||||
case TYPE_TYPEDEF:
|
||||
break;
|
||||
case TYPE_TYPEID:
|
||||
if (type_property_by_name(kw) != TYPE_PROPERTY_NONE)
|
||||
@@ -2872,7 +2872,7 @@ static inline bool sema_analyse_method(SemaContext *context, Decl *decl)
|
||||
RETURN_SEMA_ERROR(decl, "\"%s\" is not a valid method name for a typeid as this is the name of a type property.", decl->name);
|
||||
}
|
||||
break;
|
||||
case TYPE_TYPEDEF:
|
||||
case TYPE_ALIAS:
|
||||
case TYPE_OPTIONAL:
|
||||
case TYPE_WILDCARD:
|
||||
case TYPE_TYPEINFO:
|
||||
@@ -2963,8 +2963,8 @@ static const char *attribute_domain_to_string(AttributeDomain domain)
|
||||
return "alias";
|
||||
case ATTR_CALL:
|
||||
return "call";
|
||||
case ATTR_DISTINCT:
|
||||
return "distinct";
|
||||
case ATTR_TYPEDEF:
|
||||
return "typedef";
|
||||
case ATTR_INTERFACE_METHOD:
|
||||
return "interface method";
|
||||
case ATTR_FNTYPE:
|
||||
@@ -3088,7 +3088,7 @@ static bool sema_analyse_attribute(SemaContext *context, ResolvedAttrData *attr_
|
||||
[ATTRIBUTE_SAFEMACRO] = ATTR_MACRO,
|
||||
[ATTRIBUTE_SAFEINFER] = ATTR_GLOBAL | ATTR_LOCAL,
|
||||
[ATTRIBUTE_SECTION] = ATTR_FUNC | ATTR_CONST | ATTR_GLOBAL,
|
||||
[ATTRIBUTE_STRUCTLIKE] = ATTR_DISTINCT,
|
||||
[ATTRIBUTE_STRUCTLIKE] = ATTR_TYPEDEF,
|
||||
[ATTRIBUTE_TAG] = ATTR_BITSTRUCT_MEMBER | ATTR_MEMBER | USER_DEFINED_TYPES | CALLABLE_TYPE,
|
||||
[ATTRIBUTE_TEST] = ATTR_FUNC,
|
||||
[ATTRIBUTE_UNUSED] = (AttributeDomain)~(ATTR_CALL),
|
||||
@@ -3514,7 +3514,7 @@ static bool sema_analyse_attribute(SemaContext *context, ResolvedAttrData *attr_
|
||||
case ATTRIBUTE_WEAK:
|
||||
if (domain == ATTR_ALIAS)
|
||||
{
|
||||
if (decl->decl_kind != DECL_TYPEDEF) RETURN_SEMA_ERROR(attr, "'@weak' can only be used on type aliases.");
|
||||
if (decl->decl_kind != DECL_TYPE_ALIAS) RETURN_SEMA_ERROR(attr, "'@weak' can only be used on type aliases.");
|
||||
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'.");
|
||||
@@ -4915,7 +4915,7 @@ static Module *module_instantiate_generic(SemaContext *context, Module *module,
|
||||
if (is_value) RETURN_NULL_SEMA_ERROR(param, "Expected a value, not a type.");
|
||||
TypeInfo *type_info = param->type_expr;
|
||||
if (!sema_resolve_type_info(context, type_info, RESOLVE_TYPE_DEFAULT)) return NULL;
|
||||
Decl *decl = decl_new_with_type(param_name, params[i]->span, DECL_TYPEDEF);
|
||||
Decl *decl = decl_new_with_type(param_name, params[i]->span, DECL_TYPE_ALIAS);
|
||||
decl->resolve_status = RESOLVE_DONE;
|
||||
ASSERT(type_info->resolve_status == RESOLVE_DONE);
|
||||
decl->type_alias_decl.type_info = type_info;
|
||||
@@ -5003,7 +5003,7 @@ static bool sema_generate_parameterized_name_to_scratch(SemaContext *context, Mo
|
||||
{
|
||||
if (!sema_analyse_ct_expr(context, param)) return false;
|
||||
Type *type = param->type->canonical;
|
||||
if (type->type_kind == TYPE_DISTINCT) type = type_flatten(type);
|
||||
if (type->type_kind == TYPE_TYPEDEF) type = type_flatten(type);
|
||||
|
||||
bool is_enum_or_fault = type_kind_is_enum_or_fault(type->type_kind);
|
||||
if (!type_is_integer_or_bool_kind(type) && !is_enum_or_fault)
|
||||
@@ -5037,7 +5037,7 @@ static bool sema_generate_parameterized_name_to_scratch(SemaContext *context, Mo
|
||||
else
|
||||
{
|
||||
Type *type = param->type->canonical;
|
||||
if (type->type_kind == TYPE_DISTINCT)
|
||||
if (type->type_kind == TYPE_TYPEDEF)
|
||||
{
|
||||
mangle_type_param(type, mangled);
|
||||
scratch_buffer_append(mangled ? "$" : ", ");
|
||||
@@ -5329,10 +5329,10 @@ RETRY:
|
||||
case TYPE_FUNC_PTR:
|
||||
type = type->pointer;
|
||||
goto RETRY;
|
||||
case TYPE_TYPEDEF:
|
||||
case TYPE_ALIAS:
|
||||
type = type->canonical;
|
||||
goto RETRY;
|
||||
case TYPE_DISTINCT:
|
||||
case TYPE_TYPEDEF:
|
||||
if (!sema_analyse_decl(context, type->decl)) return false;
|
||||
type = type->decl->distinct->type;
|
||||
goto RETRY;
|
||||
@@ -5414,10 +5414,10 @@ bool sema_analyse_decl(SemaContext *context, Decl *decl)
|
||||
case DECL_ATTRIBUTE:
|
||||
if (!sema_analyse_attribute_decl(context, context, decl, &erase_decl)) goto FAILED;
|
||||
break;
|
||||
case DECL_DISTINCT:
|
||||
if (!sema_analyse_distinct(context, decl, &erase_decl)) goto FAILED;
|
||||
break;
|
||||
case DECL_TYPEDEF:
|
||||
if (!sema_analyse_typedef(context, decl, &erase_decl)) goto FAILED;
|
||||
break;
|
||||
case DECL_TYPE_ALIAS:
|
||||
if (!sema_analyse_type_alias(context, decl, &erase_decl)) goto FAILED;
|
||||
break;
|
||||
case DECL_ENUM:
|
||||
|
||||
Reference in New Issue
Block a user