aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-02-17 03:34:47 +0000
committermlugg <mlugg@mlugg.co.uk>2024-03-06 21:26:37 +0000
commit8ec6f730eff1f6008b7eba1c749824a4a5734e5f (patch)
tree34cf9c0ef9ab1d5ee6338984440deb1db1d7ec2e /src/Module.zig
parent975b859377dee450418ae9ed572ec9d3c0b77312 (diff)
downloadzig-8ec6f730eff1f6008b7eba1c749824a4a5734e5f.tar.gz
zig-8ec6f730eff1f6008b7eba1c749824a4a5734e5f.zip
compiler: represent captures directly in InternPool
These were previously associated with the type's namespace, but we need to store them directly in the InternPool for #18816.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 7f24a2db6d..eb3168e08b 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -761,37 +761,6 @@ pub const Namespace = struct {
/// the Decl Value has to be resolved as a Type which has a Namespace.
/// Value is whether the usingnamespace decl is marked `pub`.
usingnamespace_set: std.AutoHashMapUnmanaged(Decl.Index, bool) = .{},
- /// Allocated into `gpa`.
- /// The ordered set of values captured in this type's closure.
- /// `closure_get` instructions look up values in this list.
- captures: []CaptureValue,
-
- /// A single value captured in a container's closure. This is not an
- /// `InternPool.Index` so we can differentiate between runtime-known values
- /// (where only the type is comptime-known) and comptime-known values.
- pub const CaptureValue = enum(u32) {
- _,
- pub const Unwrapped = union(enum) {
- /// Index refers to the value.
- @"comptime": InternPool.Index,
- /// Index refers to the type.
- runtime: InternPool.Index,
- };
- pub fn wrap(val: Unwrapped) CaptureValue {
- return switch (val) {
- .@"comptime" => |i| @enumFromInt(@intFromEnum(i)),
- .runtime => |i| @enumFromInt((1 << 31) | @intFromEnum(i)),
- };
- }
- pub fn unwrap(val: CaptureValue) Unwrapped {
- const tag: u1 = @intCast(@intFromEnum(val) >> 31);
- const raw = @intFromEnum(val);
- return switch (tag) {
- 0 => .{ .@"comptime" = @enumFromInt(raw) },
- 1 => .{ .runtime = @enumFromInt(@as(u31, @truncate(raw))) },
- };
- }
- };
const Index = InternPool.NamespaceIndex;
const OptionalIndex = InternPool.OptionalNamespaceIndex;
@@ -2130,7 +2099,6 @@ pub fn deinit(zcu: *Zcu) void {
while (it.next()) |namespace| {
namespace.decls.deinit(gpa);
namespace.usingnamespace_set.deinit(gpa);
- gpa.free(namespace.captures);
}
}
@@ -3354,7 +3322,6 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void {
.parent = .none,
.decl_index = undefined,
.file_scope = file,
- .captures = &.{},
});
const new_namespace = mod.namespacePtr(new_namespace_index);
errdefer mod.destroyNamespace(new_namespace_index);