@@ -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,14 @@ 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) ) &&
1268
+ !( self . peek ( isAt: . leftParen) && self . peek ( ) . isAtStartOfLine) {
1269
+ lateSpecifiers. append ( parseNonisolatedTypeSpecifier ( ) )
1270
+ }
1271
+
1272
+ guard !specifiers. isEmpty || attributes != nil || !lateSpecifiers. isEmpty else {
1264
1273
// No specifiers or attributes on this type
1265
1274
return nil
1266
1275
}
@@ -1271,9 +1280,17 @@ extension Parser {
1271
1280
specifierList = RawTypeSpecifierListSyntax ( elements: specifiers, arena: arena)
1272
1281
}
1273
1282
1283
+ let lateSpecifierList : RawTypeSpecifierListSyntax
1284
+ if lateSpecifiers. isEmpty {
1285
+ lateSpecifierList = self . emptyCollection ( RawTypeSpecifierListSyntax . self)
1286
+ } else {
1287
+ lateSpecifierList = RawTypeSpecifierListSyntax ( elements: lateSpecifiers, arena: arena)
1288
+ }
1289
+
1274
1290
return (
1275
1291
specifierList,
1276
- attributes ?? self . emptyCollection ( RawAttributeListSyntax . self)
1292
+ attributes ?? self . emptyCollection ( RawAttributeListSyntax . self) ,
1293
+ lateSpecifierList
1277
1294
)
1278
1295
}
1279
1296
0 commit comments