std.builtin: rename Type.UnionField and Type.StructField's field_type to type
This commit is contained in:
@@ -116,7 +116,7 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands)
|
||||
};
|
||||
|
||||
inline for (fields) |field| {
|
||||
section.writeOperand(field.field_type, @field(operands, field.name));
|
||||
section.writeOperand(field.type, @field(operands, field.name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ fn writeContextDependentNumber(section: *Section, operand: spec.LiteralContextDe
|
||||
fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand) void {
|
||||
var mask: Word = 0;
|
||||
inline for (@typeInfo(Operand).Struct.fields) |field, bit| {
|
||||
switch (@typeInfo(field.field_type)) {
|
||||
switch (@typeInfo(field.type)) {
|
||||
.Optional => if (@field(operand, field.name) != null) {
|
||||
mask |= 1 << @intCast(u5, bit);
|
||||
},
|
||||
@@ -214,7 +214,7 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand
|
||||
section.writeWord(mask);
|
||||
|
||||
inline for (@typeInfo(Operand).Struct.fields) |field| {
|
||||
switch (@typeInfo(field.field_type)) {
|
||||
switch (@typeInfo(field.type)) {
|
||||
.Optional => |info| if (@field(operand, field.name)) |child| {
|
||||
section.writeOperands(info.child, child);
|
||||
},
|
||||
@@ -230,7 +230,7 @@ fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operan
|
||||
|
||||
inline for (@typeInfo(Operand).Union.fields) |field| {
|
||||
if (@field(Operand, field.name) == tag) {
|
||||
section.writeOperands(field.field_type, @field(operand, field.name));
|
||||
section.writeOperands(field.type, @field(operand, field.name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -250,7 +250,7 @@ fn operandsSize(comptime Operands: type, operands: Operands) usize {
|
||||
|
||||
var total: usize = 0;
|
||||
inline for (fields) |field| {
|
||||
total += operandSize(field.field_type, @field(operands, field.name));
|
||||
total += operandSize(field.type, @field(operands, field.name));
|
||||
}
|
||||
|
||||
return total;
|
||||
@@ -304,7 +304,7 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
|
||||
var total: usize = 0;
|
||||
var any_set = false;
|
||||
inline for (@typeInfo(Operand).Struct.fields) |field| {
|
||||
switch (@typeInfo(field.field_type)) {
|
||||
switch (@typeInfo(field.type)) {
|
||||
.Optional => |info| if (@field(operand, field.name)) |child| {
|
||||
total += operandsSize(info.child, child);
|
||||
any_set = true;
|
||||
@@ -326,7 +326,7 @@ fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {
|
||||
inline for (@typeInfo(Operand).Union.fields) |field| {
|
||||
if (@field(Operand, field.name) == tag) {
|
||||
// Add one for the tag itself.
|
||||
return 1 + operandsSize(field.field_type, @field(operand, field.name));
|
||||
return 1 + operandsSize(field.type, @field(operand, field.name));
|
||||
}
|
||||
}
|
||||
unreachable;
|
||||
|
||||
Reference in New Issue
Block a user