| ... | ... | @@ -817,8 +817,10 @@ pub const CType = extern union { |
| 817 | 817 | .Struct, .Union => |zig_tag| if (ty.isTupleOrAnonStruct()) { |
| 818 | 818 | if (lookup.isMutable()) { |
| 819 | 819 | for (0..ty.structFieldCount()) |field_i| { |
| 820 | | if (ty.structFieldIsComptime(field_i)) continue; |
| 821 | | _ = try lookup.typeToIndex(ty.structFieldType(field_i), switch (kind) { |
| 820 | const field_ty = ty.structFieldType(field_i); |
| 821 | if (ty.structFieldIsComptime(field_i) or |
| 822 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 823 | _ = try lookup.typeToIndex(field_ty, switch (kind) { |
| 822 | 824 | .forward, .complete, .parameter => .complete, |
| 823 | 825 | .global => .global, |
| 824 | 826 | }); |
| ... | ... | @@ -842,16 +844,13 @@ pub const CType = extern union { |
| 842 | 844 | .Union => ty.cast(Type.Payload.Union).?.data.fields.count(), |
| 843 | 845 | else => unreachable, |
| 844 | 846 | }) |field_i| { |
| 845 | | if (zig_tag == .Struct and ty.structFieldIsComptime(field_i)) |
| 846 | | continue; |
| 847 | | _ = try lookup.typeToIndex( |
| 848 | | ty.structFieldType(field_i), |
| 849 | | switch (kind) { |
| 850 | | .forward => unreachable, |
| 851 | | .complete, .parameter => .complete, |
| 852 | | .global => .global, |
| 853 | | }, |
| 854 | | ); |
| 847 | const field_ty = ty.structFieldType(field_i); |
| 848 | if (!field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 849 | _ = try lookup.typeToIndex(field_ty, switch (kind) { |
| 850 | .forward => unreachable, |
| 851 | .complete, .parameter => .complete, |
| 852 | .global => .global, |
| 853 | }); |
| 855 | 854 | } |
| 856 | 855 | _ = try lookup.typeToIndex(ty, .forward); |
| 857 | 856 | } |
| ... | ... | @@ -953,9 +952,9 @@ pub const CType = extern union { |
| 953 | 952 | .forward => .forward, |
| 954 | 953 | .complete, .parameter, .global => .complete, |
| 955 | 954 | }); |
| 956 | | for (info.param_types, 0..) |param_ty, param_i| { |
| 957 | | if (info.paramIsComptime(param_i)) continue; |
| 958 | | _ = try lookup.typeToIndex(param_ty, switch (kind) { |
| 955 | for (info.param_types) |param_type| { |
| 956 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 957 | _ = try lookup.typeToIndex(param_type, switch (kind) { |
| 959 | 958 | .forward => .forward, |
| 960 | 959 | .complete, .parameter, .global => unreachable, |
| 961 | 960 | }); |
| ... | ... | @@ -1118,28 +1117,28 @@ pub const CType = extern union { |
| 1118 | 1117 | |
| 1119 | 1118 | var c_fields_len: usize = 0; |
| 1120 | 1119 | for (0..fields_len) |field_i| { |
| 1121 | | if (ty.structFieldIsComptime(field_i)) continue; |
| 1120 | const field_ty = ty.structFieldType(field_i); |
| 1121 | if (ty.structFieldIsComptime(field_i) or |
| 1122 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1122 | 1123 | c_fields_len += 1; |
| 1123 | 1124 | } |
| 1124 | 1125 | |
| 1125 | 1126 | const fields_pl = try arena.alloc(Payload.Fields.Field, c_fields_len); |
| 1126 | 1127 | var c_field_i: usize = 0; |
| 1127 | 1128 | for (0..fields_len) |field_i| { |
| 1128 | | if (ty.structFieldIsComptime(field_i)) continue; |
| 1129 | const field_ty = ty.structFieldType(field_i); |
| 1130 | if (ty.structFieldIsComptime(field_i) or |
| 1131 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1129 | 1132 | |
| 1130 | 1133 | fields_pl[c_field_i] = .{ |
| 1131 | 1134 | .name = try if (ty.isSimpleTuple()) |
| 1132 | 1135 | std.fmt.allocPrintZ(arena, "f{}", .{field_i}) |
| 1133 | 1136 | else |
| 1134 | 1137 | arena.dupeZ(u8, ty.structFieldName(field_i)), |
| 1135 | | .type = store.set.typeToIndex( |
| 1136 | | ty.structFieldType(field_i), |
| 1137 | | target, |
| 1138 | | switch (kind) { |
| 1139 | | .forward, .complete, .parameter => .complete, |
| 1140 | | .global => .global, |
| 1141 | | }, |
| 1142 | | ).?, |
| 1138 | .type = store.set.typeToIndex(field_ty, target, switch (kind) { |
| 1139 | .forward, .complete, .parameter => .complete, |
| 1140 | .global => .global, |
| 1141 | }).?, |
| 1143 | 1142 | .alignas = ty.structFieldAlign(field_i, target), |
| 1144 | 1143 | }; |
| 1145 | 1144 | c_field_i += 1; |
| ... | ... | @@ -1211,16 +1210,16 @@ pub const CType = extern union { |
| 1211 | 1210 | }; |
| 1212 | 1211 | |
| 1213 | 1212 | var c_params_len: usize = 0; |
| 1214 | | for (0..info.param_types.len) |param_i| { |
| 1215 | | if (info.paramIsComptime(param_i)) continue; |
| 1213 | for (info.param_types) |param_type| { |
| 1214 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 1216 | 1215 | c_params_len += 1; |
| 1217 | 1216 | } |
| 1218 | 1217 | |
| 1219 | 1218 | const params_pl = try arena.alloc(Index, c_params_len); |
| 1220 | 1219 | var c_param_i: usize = 0; |
| 1221 | | for (info.param_types, 0..) |param_ty, param_i| { |
| 1222 | | if (info.paramIsComptime(param_i)) continue; |
| 1223 | | params_pl[c_param_i] = store.set.typeToIndex(param_ty, target, recurse_kind).?; |
| 1220 | for (info.param_types) |param_type| { |
| 1221 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 1222 | params_pl[c_param_i] = store.set.typeToIndex(param_type, target, recurse_kind).?; |
| 1224 | 1223 | c_param_i += 1; |
| 1225 | 1224 | } |
| 1226 | 1225 | |
| ... | ... | @@ -1294,7 +1293,9 @@ pub const CType = extern union { |
| 1294 | 1293 | |
| 1295 | 1294 | var c_field_i: usize = 0; |
| 1296 | 1295 | for (0..ty.structFieldCount()) |field_i| { |
| 1297 | | if (ty.structFieldIsComptime(field_i)) continue; |
| 1296 | const field_ty = ty.structFieldType(field_i); |
| 1297 | if (ty.structFieldIsComptime(field_i) or |
| 1298 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1298 | 1299 | |
| 1299 | 1300 | const c_field = &c_fields[c_field_i]; |
| 1300 | 1301 | c_field_i += 1; |
| ... | ... | @@ -1344,10 +1345,9 @@ pub const CType = extern union { |
| 1344 | 1345 | if (info.param_types.len != data.param_types.len or |
| 1345 | 1346 | !self.eqlRecurse(info.return_type, data.return_type, recurse_kind)) |
| 1346 | 1347 | return false; |
| 1347 | | for (info.param_types, data.param_types, 0..) |param_ty, param_cty, param_i| { |
| 1348 | | if (info.paramIsComptime(param_i)) continue; |
| 1349 | | if (!self.eqlRecurse(param_ty, param_cty, recurse_kind)) |
| 1350 | | return false; |
| 1348 | for (info.param_types, data.param_types) |param_ty, param_cty| { |
| 1349 | if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1350 | if (!self.eqlRecurse(param_ty, param_cty, recurse_kind)) return false; |
| 1351 | 1351 | } |
| 1352 | 1352 | return true; |
| 1353 | 1353 | }, |
| ... | ... | @@ -1389,7 +1389,9 @@ pub const CType = extern union { |
| 1389 | 1389 | std.fmt.count("f{}", .{std.math.maxInt(usize)}) |
| 1390 | 1390 | ]u8 = undefined; |
| 1391 | 1391 | for (0..ty.structFieldCount()) |field_i| { |
| 1392 | | if (ty.structFieldIsComptime(field_i)) continue; |
| 1392 | const field_ty = ty.structFieldType(field_i); |
| 1393 | if (ty.structFieldIsComptime(field_i) or |
| 1394 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1393 | 1395 | |
| 1394 | 1396 | self.updateHasherRecurse( |
| 1395 | 1397 | hasher, |
| ... | ... | @@ -1423,9 +1425,9 @@ pub const CType = extern union { |
| 1423 | 1425 | }; |
| 1424 | 1426 | |
| 1425 | 1427 | self.updateHasherRecurse(hasher, info.return_type, recurse_kind); |
| 1426 | | for (info.param_types, 0..) |param_ty, param_i| { |
| 1427 | | if (info.paramIsComptime(param_i)) continue; |
| 1428 | | self.updateHasherRecurse(hasher, param_ty, recurse_kind); |
| 1428 | for (info.param_types) |param_type| { |
| 1429 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 1430 | self.updateHasherRecurse(hasher, param_type, recurse_kind); |
| 1429 | 1431 | } |
| 1430 | 1432 | }, |
| 1431 | 1433 | |