aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig87
1 files changed, 1 insertions, 86 deletions
diff --git a/src/type.zig b/src/type.zig
index cb455d5ebe..a9ad8b94fd 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -23,92 +23,7 @@ pub const Type = struct {
}
pub fn zigTypeTagOrPoison(ty: Type, mod: *const Module) error{GenericPoison}!std.builtin.TypeId {
- return switch (mod.intern_pool.indexToKey(ty.toIntern())) {
- .int_type => .Int,
- .ptr_type => .Pointer,
- .array_type => .Array,
- .vector_type => .Vector,
- .opt_type => .Optional,
- .error_union_type => .ErrorUnion,
- .error_set_type, .inferred_error_set_type => .ErrorSet,
- .struct_type, .anon_struct_type => .Struct,
- .union_type => .Union,
- .opaque_type => .Opaque,
- .enum_type => .Enum,
- .func_type => .Fn,
- .anyframe_type => .AnyFrame,
- .simple_type => |s| switch (s) {
- .f16,
- .f32,
- .f64,
- .f80,
- .f128,
- .c_longdouble,
- => .Float,
-
- .usize,
- .isize,
- .c_char,
- .c_short,
- .c_ushort,
- .c_int,
- .c_uint,
- .c_long,
- .c_ulong,
- .c_longlong,
- .c_ulonglong,
- => .Int,
-
- .anyopaque => .Opaque,
- .bool => .Bool,
- .void => .Void,
- .type => .Type,
- .anyerror => .ErrorSet,
- .comptime_int => .ComptimeInt,
- .comptime_float => .ComptimeFloat,
- .noreturn => .NoReturn,
- .null => .Null,
- .undefined => .Undefined,
- .enum_literal => .EnumLiteral,
-
- .atomic_order,
- .atomic_rmw_op,
- .calling_convention,
- .address_space,
- .float_mode,
- .reduce_op,
- .call_modifier,
- => .Enum,
-
- .prefetch_options,
- .export_options,
- .extern_options,
- => .Struct,
-
- .type_info => .Union,
-
- .generic_poison => return error.GenericPoison,
- },
-
- // values, not types
- .undef,
- .runtime_value,
- .simple_value,
- .variable,
- .extern_func,
- .func,
- .int,
- .err,
- .error_union,
- .enum_literal,
- .enum_tag,
- .float,
- .ptr,
- .opt,
- .aggregate,
- .un,
- => unreachable,
- };
+ return mod.intern_pool.zigTypeTagOrPoison(ty.toIntern());
}
pub fn baseZigTypeTag(self: Type, mod: *Module) std.builtin.TypeId {