aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-05-26 03:41:35 -0400
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:55 -0700
commitf2c716187cf486e519482ef014b34f7271cee3cf (patch)
treed72154cb4ccf73bc346d05ff4d9e50feecfc5d9b /src/Module.zig
parent66c43968546e38879a2d4c3f2264e10676deef73 (diff)
downloadzig-f2c716187cf486e519482ef014b34f7271cee3cf.tar.gz
zig-f2c716187cf486e519482ef014b34f7271cee3cf.zip
InternPool: fix more crashes
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 3dd89f1269..0e57a0fc06 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -6699,6 +6699,11 @@ pub fn intern(mod: *Module, key: InternPool.Key) Allocator.Error!InternPool.Inde
return mod.intern_pool.get(mod.gpa, key);
}
+/// Shortcut for calling `intern_pool.getCoerced`.
+pub fn getCoerced(mod: *Module, val: Value, new_ty: Type) Allocator.Error!Value {
+ return (try mod.intern_pool.getCoerced(mod.gpa, val.toIntern(), new_ty.toIntern())).toValue();
+}
+
pub fn intType(mod: *Module, signedness: std.builtin.Signedness, bits: u16) Allocator.Error!Type {
const i = try intern(mod, .{ .int_type = .{
.signedness = signedness,