aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-06-18 21:25:03 -0400
committerGitHub <noreply@github.com>2020-06-18 21:25:03 -0400
commitc70633eacdf4e17cfafe0ab44f4ea83323b6d7a3 (patch)
tree8154639afe68f601754de51366af3a6c817eb558 /lib/std/builtin.zig
parentb9e3df92db1b5cb137d880a7612b6ee2e7e1f60e (diff)
parenta62e9bc8e50296e2d5b201614a78b0e658887aa9 (diff)
downloadzig-c70633eacdf4e17cfafe0ab44f4ea83323b6d7a3.tar.gz
zig-c70633eacdf4e17cfafe0ab44f4ea83323b6d7a3.zip
Merge pull request #5203 from tadeokondrak/@type-for-even-more-types
implement @typeInfo for Frame and implement @Type for Frame, EnumLiteral, and ErrorSet
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 195b301840..0c7e534bed 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -166,7 +166,7 @@ pub const TypeInfo = union(enum) {
Fn: Fn,
BoundFn: Fn,
Opaque: void,
- Frame: void,
+ Frame: Frame,
AnyFrame: AnyFrame,
Vector: Vector,
EnumLiteral: void,
@@ -244,8 +244,8 @@ pub const TypeInfo = union(enum) {
/// therefore must be kept in sync with the compiler implementation.
pub const Struct = struct {
layout: ContainerLayout,
- fields: []StructField,
- decls: []Declaration,
+ fields: []const StructField,
+ decls: []const Declaration,
};
/// This data structure is used by the Zig language code generation and
@@ -265,12 +265,13 @@ pub const TypeInfo = union(enum) {
/// therefore must be kept in sync with the compiler implementation.
pub const Error = struct {
name: []const u8,
+ /// This field is ignored when using @Type().
value: comptime_int,
};
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
- pub const ErrorSet = ?[]Error;
+ pub const ErrorSet = ?[]const Error;
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
@@ -284,8 +285,8 @@ pub const TypeInfo = union(enum) {
pub const Enum = struct {
layout: ContainerLayout,
tag_type: type,
- fields: []EnumField,
- decls: []Declaration,
+ fields: []const EnumField,
+ decls: []const Declaration,
is_exhaustive: bool,
};
@@ -302,8 +303,8 @@ pub const TypeInfo = union(enum) {
pub const Union = struct {
layout: ContainerLayout,
tag_type: ?type,
- fields: []UnionField,
- decls: []Declaration,
+ fields: []const UnionField,
+ decls: []const Declaration,
};
/// This data structure is used by the Zig language code generation and
@@ -321,7 +322,13 @@ pub const TypeInfo = union(enum) {
is_generic: bool,
is_var_args: bool,
return_type: ?type,
- args: []FnArg,
+ args: []const FnArg,
+ };
+
+ /// This data structure is used by the Zig language code generation and
+ /// therefore must be kept in sync with the compiler implementation.
+ pub const Frame = struct {
+ function: var,
};
/// This data structure is used by the Zig language code generation and
@@ -361,7 +368,7 @@ pub const TypeInfo = union(enum) {
is_export: bool,
lib_name: ?[]const u8,
return_type: type,
- arg_names: [][]const u8,
+ arg_names: []const []const u8,
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.