@@ -1256,44 +1256,10 @@ class Parser {
1256
1256
return isLifetimeDependenceToken ();
1257
1257
}
1258
1258
1259
- struct ParsedTypeAttributeList {
1260
- ParamDecl::Specifier Specifier = ParamDecl::Specifier::Default;
1261
- SourceLoc SpecifierLoc;
1262
- SourceLoc IsolatedLoc;
1263
- SourceLoc ConstLoc;
1264
- SourceLoc SendingLoc;
1265
- SmallVector<TypeOrCustomAttr> Attributes;
1266
- SmallVector<LifetimeDependenceSpecifier> lifetimeDependenceSpecifiers;
1267
-
1268
- // / Main entry point for parsing.
1269
- // /
1270
- // / Inline we just have the fast path of failing to match. We call slowParse
1271
- // / that contains the outline of more complex implementation. This is HOT
1272
- // / code!
1273
- ParserStatus parse (Parser &P) {
1274
- auto &Tok = P.Tok ;
1275
- if (Tok.is (tok::at_sign) || P.isParameterSpecifier ())
1276
- return slowParse (P);
1277
- return makeParserSuccess ();
1278
- }
1279
-
1280
- TypeRepr *applyAttributesToType (Parser &P, TypeRepr *Type) const ;
1281
-
1282
- private:
1283
- // / An out of line implementation of the more complicated cases. This
1284
- // / ensures on the inlined fast path we handle the case of not matching.
1285
- ParserStatus slowParse (Parser &P);
1286
- };
1287
-
1288
1259
bool parseConventionAttributeInternal (SourceLoc atLoc, SourceLoc attrLoc,
1289
1260
ConventionTypeAttr *&result,
1290
1261
bool justChecking);
1291
1262
1292
- ParserStatus parseTypeAttribute (TypeOrCustomAttr &result, SourceLoc AtLoc,
1293
- SourceLoc AtEndLoc,
1294
- PatternBindingInitializer *&initContext,
1295
- bool justChecking = false );
1296
-
1297
1263
ParserStatus parseLifetimeDependenceSpecifiers (
1298
1264
SmallVectorImpl<LifetimeDependenceSpecifier> &specifierList);
1299
1265
@@ -1432,6 +1398,8 @@ class Parser {
1432
1398
1433
1399
// / Whether the type is for a closure attribute.
1434
1400
CustomAttribute,
1401
+ // / A type in an inheritance clause.
1402
+ InheritanceClause,
1435
1403
};
1436
1404
1437
1405
ParserResult<TypeRepr> parseTypeScalar (
@@ -1488,6 +1456,43 @@ class Parser {
1488
1456
// / Parse a dotted type, e.g. 'Foo<X>.Y.Z', 'P.Type', '[X].Y'.
1489
1457
ParserResult<TypeRepr> parseTypeDotted (ParserResult<TypeRepr> Base);
1490
1458
1459
+ struct ParsedTypeAttributeList {
1460
+ ParseTypeReason ParseReason;
1461
+ ParamDecl::Specifier Specifier = ParamDecl::Specifier::Default;
1462
+ SourceLoc SpecifierLoc;
1463
+ SourceLoc IsolatedLoc;
1464
+ SourceLoc ConstLoc;
1465
+ SourceLoc SendingLoc;
1466
+ SmallVector<TypeOrCustomAttr> Attributes;
1467
+ SmallVector<LifetimeDependenceSpecifier> lifetimeDependenceSpecifiers;
1468
+
1469
+ ParsedTypeAttributeList (ParseTypeReason reason) : ParseReason(reason) {}
1470
+
1471
+ // / Main entry point for parsing.
1472
+ // /
1473
+ // / Inline we just have the fast path of failing to match. We call slowParse
1474
+ // / that contains the outline of more complex implementation. This is HOT
1475
+ // / code!
1476
+ ParserStatus parse (Parser &P) {
1477
+ auto &Tok = P.Tok ;
1478
+ if (Tok.is (tok::at_sign) || P.isParameterSpecifier ())
1479
+ return slowParse (P);
1480
+ return makeParserSuccess ();
1481
+ }
1482
+
1483
+ TypeRepr *applyAttributesToType (Parser &P, TypeRepr *Type) const ;
1484
+
1485
+ private:
1486
+ // / An out of line implementation of the more complicated cases. This
1487
+ // / ensures on the inlined fast path we handle the case of not matching.
1488
+ ParserStatus slowParse (Parser &P);
1489
+ };
1490
+
1491
+ ParserStatus parseTypeAttribute (TypeOrCustomAttr &result, SourceLoc AtLoc,
1492
+ SourceLoc AtEndLoc, ParseTypeReason reason,
1493
+ PatternBindingInitializer *&initContext,
1494
+ bool justChecking = false );
1495
+
1491
1496
ParserResult<TypeRepr> parseOldStyleProtocolComposition ();
1492
1497
ParserResult<TypeRepr> parseAnyType ();
1493
1498
ParserResult<TypeRepr> parseSILBoxType (GenericParamList *generics,
0 commit comments