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