@@ -105,7 +105,7 @@ extension ASTGenVisitor {
105105 underlyingType: self . generate ( type: node. initializer. value) ,
106106 genericWhereClause: self . generate ( genericWhereClause: node. genericWhereClause)
107107 )
108- decl . asDecl . attrs = attrs . attributes
108+ attrs. attach ( to : decl . asDecl )
109109 return decl
110110 }
111111
@@ -129,7 +129,7 @@ extension ASTGenVisitor {
129129 end: node. memberBlock. rightBrace
130130 )
131131 )
132- decl . asDecl . attrs = attrs . attributes
132+ attrs. attach ( to : decl . asDecl )
133133
134134 self . withDeclContext ( decl. asDeclContext) {
135135 decl. setParsedMembers ( self . generate ( memberBlockItemList: node. memberBlock. members) . lazy. bridgedArray ( in: self ) )
@@ -158,7 +158,7 @@ extension ASTGenVisitor {
158158 end: node. memberBlock. rightBrace
159159 )
160160 )
161- decl . asDecl . attrs = attrs . attributes
161+ attrs. attach ( to : decl . asDecl )
162162
163163 self . withDeclContext ( decl. asDeclContext) {
164164 decl. setParsedMembers ( self . generate ( memberBlockItemList: node. memberBlock. members) . lazy. bridgedArray ( in: self ) )
@@ -188,7 +188,7 @@ extension ASTGenVisitor {
188188 ) ,
189189 isActor: false
190190 )
191- decl . asDecl . attrs = attrs . attributes
191+ attrs. attach ( to : decl . asDecl )
192192
193193 self . withDeclContext ( decl. asDeclContext) {
194194 decl. setParsedMembers ( self . generate ( memberBlockItemList: node. memberBlock. members) . lazy. bridgedArray ( in: self ) )
@@ -218,7 +218,7 @@ extension ASTGenVisitor {
218218 ) ,
219219 isActor: true
220220 )
221- decl . asDecl . attrs = attrs . attributes
221+ attrs. attach ( to : decl . asDecl )
222222
223223 self . withDeclContext ( decl. asDeclContext) {
224224 decl. setParsedMembers ( self . generate ( memberBlockItemList: node. memberBlock. members) . lazy. bridgedArray ( in: self ) )
@@ -250,7 +250,7 @@ extension ASTGenVisitor {
250250 end: node. memberBlock. rightBrace
251251 )
252252 )
253- decl . asDecl . attrs = attrs . attributes
253+ attrs. attach ( to : decl . asDecl )
254254
255255 self . withDeclContext ( decl. asDeclContext) {
256256 decl. setParsedMembers ( self . generate ( memberBlockItemList: node. memberBlock. members) . lazy. bridgedArray ( in: self ) )
@@ -275,7 +275,7 @@ extension ASTGenVisitor {
275275 defaultType: self . generate ( type: node. initializer? . value) ,
276276 genericWhereClause: self . generate ( genericWhereClause: node. genericWhereClause)
277277 )
278- decl . asDecl . attrs = attrs . attributes
278+ attrs. attach ( to : decl . asDecl )
279279 return decl
280280 }
281281}
@@ -297,7 +297,7 @@ extension ASTGenVisitor {
297297 end: node. memberBlock. rightBrace
298298 )
299299 )
300- decl . asDecl . attrs = attrs . attributes
300+ attrs. attach ( to : decl . asDecl )
301301
302302 self . withDeclContext ( decl. asDeclContext) {
303303 decl. setParsedMembers ( self . generate ( memberBlockItemList: node. memberBlock. members) . lazy. bridgedArray ( in: self ) )
@@ -334,7 +334,7 @@ extension ASTGenVisitor {
334334 guard let elemDecl = self . generate ( enumCaseElement: elem) else {
335335 return nil
336336 }
337- elemDecl . asDecl . attrs = attrs . attributes
337+ attrs. attach ( to : elemDecl . asDecl )
338338 return elemDecl
339339 } )
340340 return . createParsed(
@@ -403,7 +403,8 @@ extension ASTGenVisitor {
403403 throwsSpecifierLoc: self . generateSourceLoc ( node. effectSpecifiers? . throwsClause) ,
404404 thrownType: self . generate ( type: node. effectSpecifiers? . thrownError)
405405 )
406- accessor. asDecl. setAttrs ( attrs)
406+ // FIXME: Ought to use DeclAttributesResult.attach(to:)
407+ accessor. asDecl. attrs = attrs
407408 if let body = node. body {
408409 self . withDeclContext ( accessor. asDeclContext) {
409410 accessor. setParsedBody ( self . generate ( codeBlock: body) )
@@ -564,7 +565,7 @@ extension ASTGenVisitor {
564565 arrowLoc: self . generateSourceLoc ( node. returnClause. arrow) ,
565566 returnType: self . generate ( type: node. returnClause. type)
566567 )
567- subscriptDecl . asDecl . attrs = attrs . attributes
568+ attrs. attach ( to : subscriptDecl . asDecl )
568569
569570 if let accessors = node. accessorBlock {
570571 let storage = subscriptDecl. asAbstractStorageDecl
@@ -599,7 +600,7 @@ extension ASTGenVisitor {
599600 returnType: self . generate ( type: node. signature. returnClause? . type) ,
600601 genericWhereClause: self . generate ( genericWhereClause: node. genericWhereClause)
601602 )
602- decl . asDecl . attrs = attrs . attributes
603+ attrs. attach ( to : decl . asDecl )
603604
604605 if let body = node. body {
605606 self . withDeclContext ( decl. asDeclContext) {
@@ -626,7 +627,7 @@ extension ASTGenVisitor {
626627 thrownType: self . generate ( type: node. signature. effectSpecifiers? . thrownError) ,
627628 genericWhereClause: self . generate ( genericWhereClause: node. genericWhereClause)
628629 )
629- decl . asDecl . attrs = attrs . attributes
630+ attrs. attach ( to : decl . asDecl )
630631
631632 if let body = node. body {
632633 self . withDeclContext ( decl. asDeclContext) {
@@ -645,7 +646,7 @@ extension ASTGenVisitor {
645646 declContext: self . declContext,
646647 deinitKeywordLoc: self . generateSourceLoc ( node. deinitKeyword)
647648 )
648- decl . asDecl . attrs = attrs . attributes
649+ attrs. attach ( to : decl . asDecl )
649650
650651 if let body = node. body {
651652 self . withDeclContext ( decl. asDeclContext) {
@@ -675,7 +676,7 @@ extension ASTGenVisitor {
675676 resultType: self . generate ( type: node. signature. returnClause? . type) ,
676677 definition: self . generate ( expr: node. definition? . value)
677678 )
678- decl . asDecl . setAttrs ( attrs . attributes ) ;
679+ attrs . attach ( to : decl . asDecl )
679680 return decl;
680681 }
681682}
@@ -854,7 +855,7 @@ extension ASTGenVisitor {
854855 lowerThanNames: self . generate ( precedenceGroupNameList: body. lowerThanRelation? . precedenceGroups) ,
855856 rightBraceLoc: self . generateSourceLoc ( node. rightBrace)
856857 )
857- decl . asDecl . attrs = attrs . attributes
858+ attrs. attach ( to : decl . asDecl )
858859 return decl
859860 }
860861}
@@ -901,7 +902,7 @@ extension ASTGenVisitor {
901902 self . generateLocatedIdentifier ( $0. name)
902903 } . bridgedArray ( in: self )
903904 )
904- decl . asDecl . attrs = attrs . attributes
905+ attrs. attach ( to : decl . asDecl )
905906 return decl
906907 }
907908}
0 commit comments