From ac07ddadeb36019c262b4f28a4fa3884f6f50b32 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 5 May 2023 13:26:58 -0700 Subject: InternPool: enhance integer values The Key struct now has a Storage tagged union which can store a u64, i64, or big int. This is needed so that indexToKey can be implemented for integers stored compactly in the data structure. --- src/Sema.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Sema.zig') diff --git a/src/Sema.zig b/src/Sema.zig index 3406d0d80f..37d6f3e902 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1981,7 +1981,7 @@ fn resolveMaybeUndefValAllowVariablesMaybeRuntime( if (air_tags[i] == .constant) { const ty_pl = sema.air_instructions.items(.data)[i].ty_pl; const val = sema.air_values.items[ty_pl.payload]; - if (val.tag() == .variable) return val; + if (val.tagIsVariable()) return val; } return opv; } @@ -5033,7 +5033,7 @@ fn storeToInferredAllocComptime( // There will be only one store_to_inferred_ptr because we are running at comptime. // The alloc will turn into a Decl. if (try sema.resolveMaybeUndefValAllowVariables(operand)) |operand_val| store: { - if (operand_val.tag() == .variable) break :store; + if (operand_val.tagIsVariable()) break :store; var anon_decl = try block.startAnonDecl(); defer anon_decl.deinit(); iac.data.decl_index = try anon_decl.finish( @@ -28125,7 +28125,7 @@ fn beginComptimePtrLoad( const is_mutable = ptr_val.tag() == .decl_ref_mut; const decl = sema.mod.declPtr(decl_index); const decl_tv = try decl.typedValue(); - if (decl_tv.val.tag() == .variable) return error.RuntimeLoad; + if (decl_tv.val.tagIsVariable()) return error.RuntimeLoad; const layout_defined = decl.ty.hasWellDefinedLayout(mod); break :blk ComptimePtrLoadKit{ -- cgit v1.2.3