aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-18 19:05:46 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:53 -0700
commitf21ca3da190c8c64fd99c700f0840af59792b6b2 (patch)
tree7a2853ce05fb11ad9dc81d9252f32d601459f156 /src/Module.zig
parent17882162b3be5542b4e289e5ddc6535a4bb4c6b1 (diff)
downloadzig-f21ca3da190c8c64fd99c700f0840af59792b6b2.tar.gz
zig-f21ca3da190c8c64fd99c700f0840af59792b6b2.zip
compiler: move `anyframe->T` to InternPool
Also I moved `anyframe` from being represented by `SimpleType` to being represented by the `none` tag of `anyframe_type` because most code wants to handle these two types together.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index c8e676f813..0a063a8ddc 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -6869,6 +6869,12 @@ pub fn funcType(mod: *Module, info: InternPool.Key.FuncType) Allocator.Error!Typ
return (try intern(mod, .{ .func_type = info })).toType();
}
+/// Use this for `anyframe->T` only.
+/// For `anyframe`, use the `InternPool.Index.anyframe` tag directly.
+pub fn anyframeType(mod: *Module, payload_ty: Type) Allocator.Error!Type {
+ return (try intern(mod, .{ .anyframe_type = payload_ty.toIntern() })).toType();
+}
+
/// Supports optionals in addition to pointers.
pub fn ptrIntValue(mod: *Module, ty: Type, x: u64) Allocator.Error!Value {
if (ty.isPtrLikeOptional(mod)) {