InternPool: fix more crashes

This commit is contained in:
Jacob Young
2023-05-26 03:41:35 -04:00
committed by Andrew Kelley
parent 66c4396854
commit f2c716187c
8 changed files with 502 additions and 448 deletions

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,