aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-08-31 21:52:47 -0400
committerGitHub <noreply@github.com>2021-08-31 21:52:47 -0400
commitd522f925b7f2f7f9d4782bb42eed95d5da4f3e0f (patch)
tree8a2d563320852a4fc6540424da3d2c3f8dcc9ce0 /src/type.zig
parent9d4a6d67aa3b85c64e0b2367d8ab30ae72f64834 (diff)
parent7cdb30ee95d81798beb3b13c7d2b577ab5434e84 (diff)
downloadzig-d522f925b7f2f7f9d4782bb42eed95d5da4f3e0f.tar.gz
zig-d522f925b7f2f7f9d4782bb42eed95d5da4f3e0f.zip
Merge pull request #9603 from g-w1/arrcat
stage2: add array concatenation + multiplication ( ++ and **) at comptime
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig
index 467e9c931b..aa4517ab05 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -273,6 +273,15 @@ pub const Type = extern union {
};
}
+ pub const ArrayInfo = struct { elem_type: Type, sentinel: ?Value = null, len: u64 };
+ pub fn arrayInfo(self: Type) ArrayInfo {
+ return .{
+ .len = self.arrayLen(),
+ .sentinel = self.sentinel(),
+ .elem_type = self.elemType(),
+ };
+ }
+
pub fn ptrInfo(self: Type) Payload.Pointer {
switch (self.tag()) {
.single_const_pointer_to_comptime_int => return .{ .data = .{