@@ -1030,12 +1030,12 @@ class RequirementRepr {
1030
1030
SourceLoc SeparatorLoc;
1031
1031
RequirementReprKind Kind : 2 ;
1032
1032
bool Invalid : 1 ;
1033
- TypeLoc FirstType;
1033
+ TypeRepr * FirstType;
1034
1034
1035
1035
// / The second element represents the right-hand side of the constraint.
1036
1036
// / It can be e.g. a type or a layout constraint.
1037
1037
union {
1038
- TypeLoc SecondType;
1038
+ TypeRepr * SecondType;
1039
1039
LayoutConstraintLoc SecondLayout;
1040
1040
};
1041
1041
@@ -1064,9 +1064,9 @@ class RequirementRepr {
1064
1064
// / this requirement was implied.
1065
1065
// / \param Constraint The protocol or protocol composition to which the
1066
1066
// / subject must conform, or superclass from which the subject must inherit.
1067
- static RequirementRepr getTypeConstraint (TypeLoc Subject,
1067
+ static RequirementRepr getTypeConstraint (TypeRepr * Subject,
1068
1068
SourceLoc ColonLoc,
1069
- TypeLoc Constraint) {
1069
+ TypeRepr * Constraint) {
1070
1070
return { ColonLoc, RequirementReprKind::TypeConstraint, Subject, Constraint };
1071
1071
}
1072
1072
@@ -1076,9 +1076,9 @@ class RequirementRepr {
1076
1076
// / \param EqualLoc The location of the '==' in the same-type constraint, or
1077
1077
// / an invalid location if this requirement was implied.
1078
1078
// / \param SecondType The second type.
1079
- static RequirementRepr getSameType (TypeLoc FirstType,
1079
+ static RequirementRepr getSameType (TypeRepr * FirstType,
1080
1080
SourceLoc EqualLoc,
1081
- TypeLoc SecondType) {
1081
+ TypeRepr * SecondType) {
1082
1082
return { EqualLoc, RequirementReprKind::SameType, FirstType, SecondType };
1083
1083
}
1084
1084
@@ -1090,7 +1090,7 @@ class RequirementRepr {
1090
1090
// / this requirement was implied.
1091
1091
// / \param Layout The layout requirement to which the
1092
1092
// / subject must conform.
1093
- static RequirementRepr getLayoutConstraint (TypeLoc Subject,
1093
+ static RequirementRepr getLayoutConstraint (TypeRepr * Subject,
1094
1094
SourceLoc ColonLoc,
1095
1095
LayoutConstraintLoc Layout) {
1096
1096
return {ColonLoc, RequirementReprKind::LayoutConstraint, Subject,
@@ -1108,48 +1108,15 @@ class RequirementRepr {
1108
1108
1109
1109
// / For a type-bound requirement, return the subject of the
1110
1110
// / conformance relationship.
1111
- Type getSubject () const {
1112
- assert (getKind () == RequirementReprKind::TypeConstraint ||
1113
- getKind () == RequirementReprKind::LayoutConstraint);
1114
- return FirstType.getType ();
1115
- }
1116
-
1117
1111
TypeRepr *getSubjectRepr () const {
1118
- assert (getKind () == RequirementReprKind::TypeConstraint ||
1119
- getKind () == RequirementReprKind::LayoutConstraint);
1120
- return FirstType.getTypeRepr ();
1121
- }
1122
-
1123
- TypeLoc &getSubjectLoc () {
1124
- assert (getKind () == RequirementReprKind::TypeConstraint ||
1125
- getKind () == RequirementReprKind::LayoutConstraint);
1126
- return FirstType;
1127
- }
1128
-
1129
- const TypeLoc &getSubjectLoc () const {
1130
1112
assert (getKind () == RequirementReprKind::TypeConstraint ||
1131
1113
getKind () == RequirementReprKind::LayoutConstraint);
1132
1114
return FirstType;
1133
1115
}
1134
1116
1135
1117
// / For a type-bound requirement, return the protocol or to which
1136
1118
// / the subject conforms or superclass it inherits.
1137
- Type getConstraint () const {
1138
- assert (getKind () == RequirementReprKind::TypeConstraint);
1139
- return SecondType.getType ();
1140
- }
1141
-
1142
1119
TypeRepr *getConstraintRepr () const {
1143
- assert (getKind () == RequirementReprKind::TypeConstraint);
1144
- return SecondType.getTypeRepr ();
1145
- }
1146
-
1147
- TypeLoc &getConstraintLoc () {
1148
- assert (getKind () == RequirementReprKind::TypeConstraint);
1149
- return SecondType;
1150
- }
1151
-
1152
- const TypeLoc &getConstraintLoc () const {
1153
1120
assert (getKind () == RequirementReprKind::TypeConstraint);
1154
1121
return SecondType;
1155
1122
}
@@ -1170,43 +1137,13 @@ class RequirementRepr {
1170
1137
}
1171
1138
1172
1139
// / Retrieve the first type of a same-type requirement.
1173
- Type getFirstType () const {
1174
- assert (getKind () == RequirementReprKind::SameType);
1175
- return FirstType.getType ();
1176
- }
1177
-
1178
1140
TypeRepr *getFirstTypeRepr () const {
1179
- assert (getKind () == RequirementReprKind::SameType);
1180
- return FirstType.getTypeRepr ();
1181
- }
1182
-
1183
- TypeLoc &getFirstTypeLoc () {
1184
- assert (getKind () == RequirementReprKind::SameType);
1185
- return FirstType;
1186
- }
1187
-
1188
- const TypeLoc &getFirstTypeLoc () const {
1189
1141
assert (getKind () == RequirementReprKind::SameType);
1190
1142
return FirstType;
1191
1143
}
1192
1144
1193
1145
// / Retrieve the second type of a same-type requirement.
1194
- Type getSecondType () const {
1195
- assert (getKind () == RequirementReprKind::SameType);
1196
- return SecondType.getType ();
1197
- }
1198
-
1199
1146
TypeRepr *getSecondTypeRepr () const {
1200
- assert (getKind () == RequirementReprKind::SameType);
1201
- return SecondType.getTypeRepr ();
1202
- }
1203
-
1204
- TypeLoc &getSecondTypeLoc () {
1205
- assert (getKind () == RequirementReprKind::SameType);
1206
- return SecondType;
1207
- }
1208
-
1209
- const TypeLoc &getSecondTypeLoc () const {
1210
1147
assert (getKind () == RequirementReprKind::SameType);
1211
1148
return SecondType;
1212
1149
}
@@ -1217,19 +1154,13 @@ class RequirementRepr {
1217
1154
return SeparatorLoc;
1218
1155
}
1219
1156
1220
- SourceRange getSourceRange () const {
1221
- if (getKind () == RequirementReprKind::LayoutConstraint)
1222
- return SourceRange (FirstType.getSourceRange ().Start ,
1223
- SecondLayout.getSourceRange ().End );
1224
- return SourceRange (FirstType.getSourceRange ().Start ,
1225
- SecondType.getSourceRange ().End );
1226
- }
1157
+ SourceRange getSourceRange () const ;
1227
1158
1228
1159
// / Retrieve the first or subject type representation from the \c repr,
1229
1160
// / or \c nullptr if \c repr is null.
1230
1161
static TypeRepr *getFirstTypeRepr (const RequirementRepr *repr) {
1231
1162
if (!repr) return nullptr ;
1232
- return repr->FirstType . getTypeRepr () ;
1163
+ return repr->FirstType ;
1233
1164
}
1234
1165
1235
1166
// / Retrieve the second or constraint type representation from the \c repr,
@@ -1238,7 +1169,7 @@ class RequirementRepr {
1238
1169
if (!repr) return nullptr ;
1239
1170
assert (repr->getKind () == RequirementReprKind::TypeConstraint ||
1240
1171
repr->getKind () == RequirementReprKind::SameType);
1241
- return repr->SecondType . getTypeRepr () ;
1172
+ return repr->SecondType ;
1242
1173
}
1243
1174
1244
1175
SWIFT_DEBUG_DUMP;
0 commit comments