asm...
This commit is contained in:
@@ -24,6 +24,8 @@ pub const Type = union(enum) {
|
||||
function_type: FunctionTypeInfo,
|
||||
closure_type: ClosureTypeInfo,
|
||||
any_type,
|
||||
usize_type,
|
||||
isize_type,
|
||||
optional_type: OptionalTypeInfo,
|
||||
meta_type: MetaTypeInfo,
|
||||
tuple_type: TupleTypeInfo,
|
||||
@@ -82,7 +84,7 @@ pub const Type = union(enum) {
|
||||
return switch (self) {
|
||||
.signed => |w| w == other.signed,
|
||||
.unsigned => |w| w == other.unsigned,
|
||||
.f32, .f64, .void_type, .boolean, .string_type, .any_type => true,
|
||||
.f32, .f64, .void_type, .boolean, .string_type, .any_type, .usize_type, .isize_type => true,
|
||||
.enum_type => |n| std.mem.eql(u8, n, other.enum_type),
|
||||
.struct_type => |n| std.mem.eql(u8, n, other.struct_type),
|
||||
.union_type => |n| std.mem.eql(u8, n, other.union_type),
|
||||
@@ -149,12 +151,17 @@ pub const Type = union(enum) {
|
||||
return null;
|
||||
},
|
||||
'u' => {
|
||||
if (std.mem.eql(u8, name, "usize")) return .usize_type;
|
||||
if (name.len >= 2) {
|
||||
const width = std.fmt.parseInt(u8, name[1..], 10) catch return null;
|
||||
if (width >= 1 and width <= 64) return Type.u(width);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
'i' => {
|
||||
if (std.mem.eql(u8, name, "isize")) return .isize_type;
|
||||
return null;
|
||||
},
|
||||
'b' => if (std.mem.eql(u8, name, "bool")) .boolean else null,
|
||||
'f' => {
|
||||
if (std.mem.eql(u8, name, "f32")) return .f32;
|
||||
@@ -223,6 +230,8 @@ pub const Type = union(enum) {
|
||||
.boolean => "bool",
|
||||
.string_type => "string",
|
||||
.void_type => "void",
|
||||
.usize_type => "usize",
|
||||
.isize_type => "isize",
|
||||
.struct_type => |n| n,
|
||||
.enum_type => |n| n,
|
||||
.union_type => |n| n,
|
||||
@@ -544,6 +553,8 @@ pub const Type = union(enum) {
|
||||
.string_type => "string",
|
||||
.void_type => "void",
|
||||
.any_type => "Any",
|
||||
.usize_type => "usize",
|
||||
.isize_type => "isize",
|
||||
.enum_type => |name| name,
|
||||
.struct_type => |name| name,
|
||||
.union_type => |name| name,
|
||||
|
||||
Reference in New Issue
Block a user