InternPool: fix more crashes

This commit is contained in:
Jacob Young authored and Andrew Kelley committed 2023-06-10 20:47:55 -07:00
1 parent 66c4396854
commit f2c716187c
8 files changed
+502 -448

No files matched your search

+5
View File
@@ -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,