aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-03 12:42:09 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:40:03 -0700
commitd1887ab1dde6b92e9cec374890d4c425b42ad376 (patch)
treef6130f9e5439f3dbbd72fceafbe62d4d554af127 /src/type.zig
parentb125063dcfb95b470bc7830b188614361d3ba4cb (diff)
downloadzig-d1887ab1dde6b92e9cec374890d4c425b42ad376.tar.gz
zig-d1887ab1dde6b92e9cec374890d4c425b42ad376.zip
InternPool: implement hasRuntimeBitsAdvanced for simple_type
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig53
1 files changed, 51 insertions, 2 deletions
diff --git a/src/type.zig b/src/type.zig
index a4f1f5174b..eaa240aa1e 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -2440,7 +2440,55 @@ pub const Type = struct {
.vector_type => @panic("TODO"),
.optional_type => @panic("TODO"),
.error_union_type => @panic("TODO"),
- .simple_type => @panic("TODO"),
+ .simple_type => |t| return switch (t) {
+ .f16,
+ .f32,
+ .f64,
+ .f80,
+ .f128,
+ .usize,
+ .isize,
+ .c_char,
+ .c_short,
+ .c_ushort,
+ .c_int,
+ .c_uint,
+ .c_long,
+ .c_ulong,
+ .c_longlong,
+ .c_ulonglong,
+ .c_longdouble,
+ .bool,
+ .anyerror,
+ .@"anyframe",
+ .anyopaque,
+ .atomic_order,
+ .atomic_rmw_op,
+ .calling_convention,
+ .address_space,
+ .float_mode,
+ .reduce_op,
+ .call_modifier,
+ .prefetch_options,
+ .export_options,
+ .extern_options,
+ => true,
+
+ // These are false because they are comptime-only types.
+ .void,
+ .type,
+ .comptime_int,
+ .comptime_float,
+ .noreturn,
+ .null,
+ .undefined,
+ .enum_literal,
+ .type_info,
+ => false,
+
+ .generic_poison => unreachable,
+ .var_args_param => unreachable,
+ },
.struct_type => @panic("TODO"),
.simple_value => unreachable,
.extern_func => unreachable,
@@ -2500,7 +2548,6 @@ pub const Type = struct {
.@"anyframe",
.anyopaque,
.@"opaque",
- .type_info,
.error_set_single,
.error_union,
.error_set,
@@ -2545,6 +2592,7 @@ pub const Type = struct {
.enum_literal,
.empty_struct,
.empty_struct_literal,
+ .type_info,
// These are function *bodies*, not pointers.
// Special exceptions have to be made when emitting functions due to
// this returning false.
@@ -5075,6 +5123,7 @@ pub const Type = struct {
.undefined => return Value.undef,
.generic_poison => unreachable,
+ .var_args_param => unreachable,
},
.struct_type => @panic("TODO"),
.simple_value => unreachable,