@@ -1256,44 +1256,10 @@ class Parser {
12561256 return isLifetimeDependenceToken ();
12571257 }
12581258
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-
12881259 bool parseConventionAttributeInternal (SourceLoc atLoc, SourceLoc attrLoc,
12891260 ConventionTypeAttr *&result,
12901261 bool justChecking);
12911262
1292- ParserStatus parseTypeAttribute (TypeOrCustomAttr &result, SourceLoc AtLoc,
1293- SourceLoc AtEndLoc,
1294- PatternBindingInitializer *&initContext,
1295- bool justChecking = false );
1296-
12971263 ParserStatus parseLifetimeDependenceSpecifiers (
12981264 SmallVectorImpl<LifetimeDependenceSpecifier> &specifierList);
12991265
@@ -1432,6 +1398,8 @@ class Parser {
14321398
14331399 // / Whether the type is for a closure attribute.
14341400 CustomAttribute,
1401+ // / A type in an inheritance clause.
1402+ InheritanceClause,
14351403 };
14361404
14371405 ParserResult<TypeRepr> parseTypeScalar (
@@ -1488,6 +1456,43 @@ class Parser {
14881456 // / Parse a dotted type, e.g. 'Foo<X>.Y.Z', 'P.Type', '[X].Y'.
14891457 ParserResult<TypeRepr> parseTypeDotted (ParserResult<TypeRepr> Base);
14901458
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+
14911496 ParserResult<TypeRepr> parseOldStyleProtocolComposition ();
14921497 ParserResult<TypeRepr> parseAnyType ();
14931498 ParserResult<TypeRepr> parseSILBoxType (GenericParamList *generics,
0 commit comments