Pass 'type_alias'
This commit is contained in:
parent
9d1b86bc68
commit
e75d295b0e
@ -1400,6 +1400,13 @@ TypeBits = struct
|
|||||||
is_implicit_backing_type: u1,
|
is_implicit_backing_type: u1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TypeAlias = struct
|
||||||
|
{
|
||||||
|
type: &Type,
|
||||||
|
scope: &Scope,
|
||||||
|
line: u32,
|
||||||
|
}
|
||||||
|
|
||||||
TypeContent = union
|
TypeContent = union
|
||||||
{
|
{
|
||||||
integer: TypeInteger,
|
integer: TypeInteger,
|
||||||
@ -1410,6 +1417,7 @@ TypeContent = union
|
|||||||
enum: TypeEnum,
|
enum: TypeEnum,
|
||||||
struct: TypeStruct,
|
struct: TypeStruct,
|
||||||
bits: TypeBits,
|
bits: TypeBits,
|
||||||
|
alias: TypeAlias,
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeLLVM = struct
|
TypeLLVM = struct
|
||||||
@ -3951,6 +3959,10 @@ resolve_alias = fn (module: &Module, type: &Type) &Type
|
|||||||
result = type;
|
result = type;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
.alias =>
|
||||||
|
{
|
||||||
|
result = resolve_alias(module, type.content.alias.type);
|
||||||
|
},
|
||||||
else =>
|
else =>
|
||||||
{
|
{
|
||||||
#trap();
|
#trap();
|
||||||
@ -7080,7 +7092,26 @@ parse = fn (module: &Module) void
|
|||||||
},
|
},
|
||||||
.typealias =>
|
.typealias =>
|
||||||
{
|
{
|
||||||
#trap();
|
>aliased_type = parse_type(module, scope);
|
||||||
|
|
||||||
|
if (!consume_character_if_match(module, ';'))
|
||||||
|
{
|
||||||
|
report_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
>alias_type = new_type(module, {
|
||||||
|
.content = {
|
||||||
|
.alias = {
|
||||||
|
.type = aliased_type,
|
||||||
|
.scope = scope,
|
||||||
|
.line = global_line,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.id = .alias,
|
||||||
|
.name = global_name,
|
||||||
|
.scope = scope,
|
||||||
|
zero,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
.union =>
|
.union =>
|
||||||
{
|
{
|
||||||
@ -15844,6 +15875,7 @@ names: [_][]u8 =
|
|||||||
"pointer_decay",
|
"pointer_decay",
|
||||||
"enum_name",
|
"enum_name",
|
||||||
"slice_of_slices",
|
"slice_of_slices",
|
||||||
|
"type_alias",
|
||||||
];
|
];
|
||||||
|
|
||||||
[export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32
|
[export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user