std.builtin: rename Type.UnionField and Type.StructField's field_type to type

This commit is contained in:
r00ster91
2022-12-13 22:30:06 +01:00
parent 7350ea3e2d
commit aac2d6b56f
60 changed files with 177 additions and 178 deletions

View File

@@ -125,7 +125,7 @@ pub fn extraData(tree: Ast, index: usize, comptime T: type) T {
const fields = std.meta.fields(T);
var result: T = undefined;
inline for (fields) |field, i| {
comptime assert(field.field_type == Node.Index);
comptime assert(field.type == Node.Index);
@field(result, field.name) = tree.extra_data[index + i];
}
return result;

View File

@@ -50,7 +50,7 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
},
.Union => |info| {
inline for (info.fields) |field| {
if (field.field_type == SourceType) return @unionInit(DestType, field.name, target);
if (field.type == SourceType) return @unionInit(DestType, field.name, target);
}
@compileError("cast to union type '" ++ @typeName(DestType) ++ "' from type '" ++ @typeName(SourceType) ++ "' which is not present in union");
},

View File

@@ -153,7 +153,7 @@ const Parser = struct {
try p.extra_data.ensureUnusedCapacity(p.gpa, fields.len);
const result = @intCast(u32, p.extra_data.items.len);
inline for (fields) |field| {
comptime assert(field.field_type == Node.Index);
comptime assert(field.type == Node.Index);
p.extra_data.appendAssumeCapacity(@field(extra, field.name));
}
return result;