aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-05-21 04:29:34 -0400
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:54 -0700
commita6fcf469fc8982d36597586ac0dbba94027b2429 (patch)
tree728ea43b19c84f34aaa8d1b4b52573b469dd24b7 /src/Module.zig
parent84099e50fc0af3719f3819c6c2d37dedba1aaae4 (diff)
downloadzig-a6fcf469fc8982d36597586ac0dbba94027b2429.tar.gz
zig-a6fcf469fc8982d36597586ac0dbba94027b2429.zip
Value: remove legacy type values
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 832368c0d0..f4bf487128 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -841,16 +841,16 @@ pub const Decl = struct {
pub fn getStructIndex(decl: *Decl, mod: *Module) Struct.OptionalIndex {
if (!decl.owns_tv) return .none;
- const ty = (decl.val.castTag(.ty) orelse return .none).data;
- return mod.intern_pool.indexToStructType(ty.ip_index);
+ if (decl.val.ip_index == .none) return .none;
+ return mod.intern_pool.indexToStructType(decl.val.ip_index);
}
/// If the Decl has a value and it is a union, return it,
/// otherwise null.
pub fn getUnion(decl: *Decl, mod: *Module) ?*Union {
if (!decl.owns_tv) return null;
- const ty = (decl.val.castTag(.ty) orelse return null).data;
- return mod.typeToUnion(ty);
+ if (decl.val.ip_index == .none) return null;
+ return mod.typeToUnion(decl.val.toType());
}
/// If the Decl has a value and it is a function, return it,
@@ -4695,8 +4695,8 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {
return sema.fail(&block_scope, ty_src, "type {} has no namespace", .{ty.fmt(mod)});
}
- decl.ty = Type.type;
- decl.val = try Value.Tag.ty.create(decl_arena_allocator, ty);
+ decl.ty = InternPool.Index.type_type.toType();
+ decl.val = ty.toValue();
decl.@"align" = 0;
decl.@"linksection" = null;
decl.has_tv = true;