@@ -133,14 +133,14 @@ class DerivedConformance {
133
133
// /
134
134
// / \returns True if the requirement can be derived.
135
135
static bool canDeriveComparable (DeclContext *DC, EnumDecl *enumeration);
136
-
136
+
137
137
// / Derive an Equatable requirement for a type.
138
138
// /
139
139
// / This is implemented for enums without associated or raw values.
140
140
// /
141
141
// / \returns the derived member, which will also be added to the type.
142
142
ValueDecl *deriveComparable (ValueDecl *requirement);
143
-
143
+
144
144
// / Determine if an Equatable requirement can be derived for a type.
145
145
// /
146
146
// / This is implemented for enums without associated values or all-Equatable
@@ -232,42 +232,42 @@ class DerivedConformance {
232
232
// /
233
233
// / \param synthesizing The decl that is being synthesized.
234
234
bool checkAndDiagnoseDisallowedContext (ValueDecl *synthesizing) const ;
235
-
235
+
236
236
// / Returns a generated guard statement that checks whether the given lhs and
237
237
// / rhs expressions are equal. If not equal, the else block for the guard
238
238
// / returns `guardReturnValue`.
239
239
// / \p C The AST context.
240
240
// / \p lhsExpr The first expression to compare for equality.
241
241
// / \p rhsExpr The second expression to compare for equality.
242
- // / \p guardReturnValue The expression to return if the two sides are not equal
243
- static
244
- GuardStmt *returnIfNotEqualGuard (ASTContext &C, Expr *lhsExpr, Expr *rhsExpr,
245
- Expr *guardReturnValue);
246
- // return false
247
- static
248
- GuardStmt *returnFalseIfNotEqualGuard (ASTContext &C, Expr *lhsExpr, Expr *rhsExpr);
242
+ // / \p guardReturnValue The expression to return if the two sides are not
243
+ // / equal
244
+ static GuardStmt *returnIfNotEqualGuard (ASTContext &C, Expr *lhsExpr,
245
+ Expr *rhsExpr,
246
+ Expr *guardReturnValue);
247
+ // return false
248
+ static GuardStmt *returnFalseIfNotEqualGuard (ASTContext &C, Expr *lhsExpr,
249
+ Expr *rhsExpr);
249
250
// return lhs < rhs
250
- static
251
- GuardStmt * returnComparisonIfNotEqualGuard (ASTContext &C, Expr *lhsExpr, Expr *rhsExpr);
252
-
253
- // / Returns the ParamDecl for each associated value of the given enum whose type
254
- // / does not conform to a protocol
255
- // / \p theEnum The enum whose elements and associated values should be checked.
256
- // / \p protocol The protocol being requested.
257
- // / \return The ParamDecl of each associated value whose type does not conform.
251
+ static GuardStmt *
252
+ returnComparisonIfNotEqualGuard (ASTContext &C, Expr *lhsExpr, Expr *rhsExpr);
253
+
254
+ // / Returns the ParamDecl for each associated value of the given enum whose
255
+ // / type does not conform to a protocol \p theEnum The enum whose elements and
256
+ // / associated values should be checked. \p protocol The protocol being
257
+ // / requested. \return The ParamDecl of each associated value whose type does
258
+ // / not conform.
258
259
static SmallVector<ParamDecl *, 3 >
259
260
associatedValuesNotConformingToProtocol (DeclContext *DC, EnumDecl *theEnum,
260
- ProtocolDecl *protocol);
261
+ ProtocolDecl *protocol);
261
262
262
263
// / Returns true if, for every element of the given enum, it either has no
263
264
// / associated values or all of them conform to a protocol.
264
- // / \p theEnum The enum whose elements and associated values should be checked.
265
- // / \p protocol The protocol being requested.
266
- // / \return True if all associated values of all elements of the enum conform.
267
- static bool
268
- allAssociatedValuesConformToProtocol (DeclContext *DC,
269
- EnumDecl *theEnum,
270
- ProtocolDecl *protocol);
265
+ // / \p theEnum The enum whose elements and associated values should be
266
+ // / checked. \p protocol The protocol being requested. \return True if all
267
+ // / associated values of all elements of the enum conform.
268
+ static bool allAssociatedValuesConformToProtocol (DeclContext *DC,
269
+ EnumDecl *theEnum,
270
+ ProtocolDecl *protocol);
271
271
// / Create AST statements which convert from an enum to an Int with a switch.
272
272
// / \p stmts The generated statements are appended to this vector.
273
273
// / \p parentDC Either an extension or the enum itself.
@@ -277,22 +277,18 @@ class DerivedConformance {
277
277
// / \p indexName The name of the output variable.
278
278
// / \return A DeclRefExpr of the output variable (of type Int).
279
279
static DeclRefExpr *
280
- convertEnumToIndex ( SmallVectorImpl<ASTNode> &stmts,
281
- DeclContext *parentDC,
282
- EnumDecl *enumDecl,
283
- VarDecl *enumVarDecl,
284
- AbstractFunctionDecl *funcDecl,
285
- const char *indexName);
286
-
287
- static Pattern*
288
- enumElementPayloadSubpattern (EnumElementDecl *enumElementDecl,
289
- char varPrefix, DeclContext *varContext,
290
- SmallVectorImpl<VarDecl*> &boundVars);
291
-
292
- static VarDecl *
293
- indexedVarDecl (char prefixChar, int index, Type type,
294
- DeclContext *varContext);
280
+ convertEnumToIndex (SmallVectorImpl<ASTNode> &stmts, DeclContext *parentDC,
281
+ EnumDecl *enumDecl, VarDecl *enumVarDecl,
282
+ AbstractFunctionDecl *funcDecl, const char *indexName);
283
+
284
+ static Pattern *
285
+ enumElementPayloadSubpattern (EnumElementDecl *enumElementDecl, char varPrefix,
286
+ DeclContext *varContext,
287
+ SmallVectorImpl<VarDecl *> &boundVars);
288
+
289
+ static VarDecl *indexedVarDecl (char prefixChar, int index, Type type,
290
+ DeclContext *varContext);
295
291
};
296
- }
292
+ } // namespace swift
297
293
298
294
#endif
0 commit comments