aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/value.zig')
-rw-r--r--src/value.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/value.zig b/src/value.zig
index d2d7be3007..04608878c0 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -593,6 +593,14 @@ pub const Value = extern union {
unreachable;
}
+ /// Returns null if not a type or if the type has no namespace.
+ pub fn getTypeNamespace(self: Value) ?*Module.Scope.Namespace {
+ return switch (self.tag()) {
+ .ty => self.castTag(.ty).?.data.getNamespace(),
+ else => null,
+ };
+ }
+
/// Asserts that the value is representable as a type.
pub fn toType(self: Value, allocator: *Allocator) !Type {
return switch (self.tag()) {