aboutsummaryrefslogtreecommitdiff
path: root/src/Zcu
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-09-25 11:11:48 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-09-26 12:35:14 -0700
commit4f8d244e7ea47a8cdb41496d51961ef4ba3ec2af (patch)
treec12d45a7aeadec432e0e40760923ac3c6ea937bc /src/Zcu
parent04e694ad116ad2706328c13ce3643347330a861f (diff)
downloadzig-4f8d244e7ea47a8cdb41496d51961ef4ba3ec2af.tar.gz
zig-4f8d244e7ea47a8cdb41496d51961ef4ba3ec2af.zip
remove formatted panics
implements #17969
Diffstat (limited to 'src/Zcu')
-rw-r--r--src/Zcu/PerThread.zig12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig
index a11910302d..a0e90e60bd 100644
--- a/src/Zcu/PerThread.zig
+++ b/src/Zcu/PerThread.zig
@@ -2697,11 +2697,16 @@ pub fn reportRetryableFileError(
gop.value_ptr.* = err_msg;
}
-///Shortcut for calling `intern_pool.get`.
+/// Shortcut for calling `intern_pool.get`.
pub fn intern(pt: Zcu.PerThread, key: InternPool.Key) Allocator.Error!InternPool.Index {
return pt.zcu.intern_pool.get(pt.zcu.gpa, pt.tid, key);
}
+/// Shortcut for calling `intern_pool.getUnion`.
+pub fn internUnion(pt: Zcu.PerThread, un: InternPool.Key.Union) Allocator.Error!InternPool.Index {
+ return pt.zcu.intern_pool.getUnion(pt.zcu.gpa, pt.tid, un);
+}
+
/// Essentially a shortcut for calling `intern_pool.getCoerced`.
/// However, this function also allows coercing `extern`s. The `InternPool` function can't do
/// this because it requires potentially pushing to the job queue.
@@ -2949,11 +2954,12 @@ pub fn intValue_i64(pt: Zcu.PerThread, ty: Type, x: i64) Allocator.Error!Value {
}
pub fn unionValue(pt: Zcu.PerThread, union_ty: Type, tag: Value, val: Value) Allocator.Error!Value {
- return Value.fromInterned(try pt.intern(.{ .un = .{
+ const zcu = pt.zcu;
+ return Value.fromInterned(try zcu.intern_pool.getUnion(zcu.gpa, pt.tid, .{
.ty = union_ty.toIntern(),
.tag = tag.toIntern(),
.val = val.toIntern(),
- } }));
+ }));
}
/// This function casts the float representation down to the representation of the type, potentially