@@ -100,6 +100,7 @@ extension Parser {
100
100
RawAttributedTypeSyntax (
101
101
specifiers: specifiersAndAttributes. specifiers,
102
102
attributes: specifiersAndAttributes. attributes,
103
+ lateSpecifiers: specifiersAndAttributes. lateSpecifiers,
103
104
baseType: base,
104
105
arena: self . arena
105
106
)
@@ -1221,7 +1222,8 @@ extension Parser {
1221
1222
misplacedSpecifiers: [ RawTokenSyntax ] = [ ]
1222
1223
) -> (
1223
1224
specifiers: RawTypeSpecifierListSyntax ,
1224
- attributes: RawAttributeListSyntax
1225
+ attributes: RawAttributeListSyntax ,
1226
+ lateSpecifiers: RawTypeSpecifierListSyntax
1225
1227
) ? {
1226
1228
var specifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
1227
1229
SPECIFIER_PARSING: while canHaveParameterSpecifier {
@@ -1260,7 +1262,15 @@ extension Parser {
1260
1262
attributes = nil
1261
1263
}
1262
1264
1263
- guard !specifiers. isEmpty || attributes != nil else {
1265
+ // Only handle `nonisolated` as a late specifier.
1266
+ var lateSpecifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
1267
+ if self . at ( . keyword( . nonisolated) ) && !( self . peek ( isAt: . leftParen) && self . peek ( ) . isAtStartOfLine)
1268
+ && canHaveParameterSpecifier
1269
+ {
1270
+ lateSpecifiers. append ( parseNonisolatedTypeSpecifier ( ) )
1271
+ }
1272
+
1273
+ guard !specifiers. isEmpty || attributes != nil || !lateSpecifiers. isEmpty else {
1264
1274
// No specifiers or attributes on this type
1265
1275
return nil
1266
1276
}
@@ -1271,9 +1281,17 @@ extension Parser {
1271
1281
specifierList = RawTypeSpecifierListSyntax ( elements: specifiers, arena: arena)
1272
1282
}
1273
1283
1284
+ let lateSpecifierList : RawTypeSpecifierListSyntax
1285
+ if lateSpecifiers. isEmpty {
1286
+ lateSpecifierList = self . emptyCollection ( RawTypeSpecifierListSyntax . self)
1287
+ } else {
1288
+ lateSpecifierList = RawTypeSpecifierListSyntax ( elements: lateSpecifiers, arena: arena)
1289
+ }
1290
+
1274
1291
return (
1275
1292
specifierList,
1276
- attributes ?? self . emptyCollection ( RawAttributeListSyntax . self)
1293
+ attributes ?? self . emptyCollection ( RawAttributeListSyntax . self) ,
1294
+ lateSpecifierList
1277
1295
)
1278
1296
}
1279
1297
0 commit comments