diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/builtin.zig | 27 | ||||
| -rw-r--r-- | lib/std/meta.zig | 12 |
2 files changed, 23 insertions, 16 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. diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 75f507da74..f93f035429 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -250,7 +250,7 @@ test "std.meta.containerLayout" { testing.expect(containerLayout(U3) == .Extern); } -pub fn declarations(comptime T: type) []TypeInfo.Declaration { +pub fn declarations(comptime T: type) []const TypeInfo.Declaration { return switch (@typeInfo(T)) { .Struct => |info| info.decls, .Enum => |info| info.decls, @@ -274,7 +274,7 @@ test "std.meta.declarations" { fn a() void {} }; - const decls = comptime [_][]TypeInfo.Declaration{ + const decls = comptime [_][]const TypeInfo.Declaration{ declarations(E1), declarations(S1), declarations(U1), @@ -323,10 +323,10 @@ test "std.meta.declarationInfo" { } pub fn fields(comptime T: type) switch (@typeInfo(T)) { - .Struct => []TypeInfo.StructField, - .Union => []TypeInfo.UnionField, - .ErrorSet => []TypeInfo.Error, - .Enum => []TypeInfo.EnumField, + .Struct => []const TypeInfo.StructField, + .Union => []const TypeInfo.UnionField, + .ErrorSet => []const TypeInfo.Error, + .Enum => []const TypeInfo.EnumField, else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), } { return switch (@typeInfo(T)) { |
