@@ -1249,45 +1249,10 @@ class Parser {
12491249 return isLifetimeDependenceToken ();
12501250 }
12511251
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-
12821252 bool parseConventionAttributeInternal (SourceLoc atLoc, SourceLoc attrLoc,
12831253 ConventionTypeAttr *&result,
12841254 bool justChecking);
12851255
1286- ParserStatus parseTypeAttribute (TypeOrCustomAttr &result, SourceLoc AtLoc,
1287- SourceLoc AtEndLoc,
1288- PatternBindingInitializer *&initContext,
1289- bool justChecking = false );
1290-
12911256 ParserStatus parseLifetimeDependenceSpecifiers (
12921257 SmallVectorImpl<LifetimeDependenceSpecifier> &specifierList);
12931258
@@ -1426,6 +1391,8 @@ class Parser {
14261391
14271392 // / Whether the type is for a closure attribute.
14281393 CustomAttribute,
1394+ // / A type in an inheritance clause.
1395+ InheritanceClause,
14291396 };
14301397
14311398 ParserResult<TypeRepr> parseTypeScalar (
@@ -1482,6 +1449,44 @@ class Parser {
14821449 // / Parse a dotted type, e.g. 'Foo<X>.Y.Z', 'P.Type', '[X].Y'.
14831450 ParserResult<TypeRepr> parseTypeDotted (ParserResult<TypeRepr> Base);
14841451
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+
14851490 ParserResult<TypeRepr> parseOldStyleProtocolComposition ();
14861491 ParserResult<TypeRepr> parseAnyType ();
14871492 ParserResult<TypeRepr> parseSILBoxType (GenericParamList *generics,
0 commit comments