@@ -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
)
@@ -1215,7 +1216,8 @@ extension Parser {
1215
1216
misplacedSpecifiers: [ RawTokenSyntax ] = [ ]
1216
1217
) -> (
1217
1218
specifiers: RawTypeSpecifierListSyntax ,
1218
- attributes: RawAttributeListSyntax
1219
+ attributes: RawAttributeListSyntax ,
1220
+ lateSpecifiers: RawTypeSpecifierListSyntax
1219
1221
) ? {
1220
1222
var specifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
1221
1223
SPECIFIER_PARSING: while canHaveParameterSpecifier {
@@ -1254,7 +1256,15 @@ extension Parser {
1254
1256
attributes = nil
1255
1257
}
1256
1258
1257
- guard !specifiers. isEmpty || attributes != nil else {
1259
+ // Only handle `nonisolated` as a late specifier.
1260
+ var lateSpecifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
1261
+ if self . at ( . keyword( . nonisolated) ) && !( self . peek ( isAt: . leftParen) && self . peek ( ) . isAtStartOfLine)
1262
+ && canHaveParameterSpecifier
1263
+ {
1264
+ lateSpecifiers. append ( parseNonisolatedTypeSpecifier ( ) )
1265
+ }
1266
+
1267
+ guard !specifiers. isEmpty || attributes != nil || !lateSpecifiers. isEmpty else {
1258
1268
// No specifiers or attributes on this type
1259
1269
return nil
1260
1270
}
@@ -1265,9 +1275,17 @@ extension Parser {
1265
1275
specifierList = RawTypeSpecifierListSyntax ( elements: specifiers, arena: arena)
1266
1276
}
1267
1277
1278
+ let lateSpecifierList : RawTypeSpecifierListSyntax
1279
+ if lateSpecifiers. isEmpty {
1280
+ lateSpecifierList = self . emptyCollection ( RawTypeSpecifierListSyntax . self)
1281
+ } else {
1282
+ lateSpecifierList = RawTypeSpecifierListSyntax ( elements: lateSpecifiers, arena: arena)
1283
+ }
1284
+
1268
1285
return (
1269
1286
specifierList,
1270
- attributes ?? self . emptyCollection ( RawAttributeListSyntax . self)
1287
+ attributes ?? self . emptyCollection ( RawAttributeListSyntax . self) ,
1288
+ lateSpecifierList
1271
1289
)
1272
1290
}
1273
1291
0 commit comments