aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig
index 4682b3ed10..ca18b182a6 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -2347,11 +2347,13 @@ pub const Type = extern union {
}
}
- /// Asserts that the type is an optional
+ /// Asserts that the type is an optional or a pointer that can be null.
pub fn isPtrLikeOptional(self: Type) bool {
switch (self.tag()) {
.optional_single_const_pointer,
.optional_single_mut_pointer,
+ .c_const_pointer,
+ .c_mut_pointer,
=> return true,
.optional => {
@@ -2367,6 +2369,8 @@ pub const Type = extern union {
.Many, .One => return !info.@"allowzero",
}
},
+
+ .pointer => return self.castTag(.pointer).?.data.size == .C,
else => unreachable,
}
}