std.builtin: rename Type.UnionField and Type.StructField's field_type to type
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user