diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-25 19:41:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-25 19:41:19 -0400 |
| commit | df198ea60e05664b5b72a43aae815fa06d94c19c (patch) | |
| tree | edf13ce2d73ab17a56d6b07b4734b97260bde3eb /src/type.zig | |
| parent | 30d01c8fea68baab396081da040f49defa494088 (diff) | |
| parent | 21bf3b80666c14c9b2a2e1ec984a6b4bb23a5bb7 (diff) | |
| download | zig-df198ea60e05664b5b72a43aae815fa06d94c19c.tar.gz zig-df198ea60e05664b5b72a43aae815fa06d94c19c.zip | |
Merge pull request #10034 from Snektron/stage2-slice
stage2: slice and optional improvements
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 6 |
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, } } |
