diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-05-26 03:41:35 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:47:55 -0700 |
| commit | f2c716187cf486e519482ef014b34f7271cee3cf (patch) | |
| tree | d72154cb4ccf73bc346d05ff4d9e50feecfc5d9b /src/Module.zig | |
| parent | 66c43968546e38879a2d4c3f2264e10676deef73 (diff) | |
| download | zig-f2c716187cf486e519482ef014b34f7271cee3cf.tar.gz zig-f2c716187cf486e519482ef014b34f7271cee3cf.zip | |
InternPool: fix more crashes
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 5 |
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, |
