@@ -14,7 +14,7 @@ import ASTBridging
1414import BasicBridging
1515import SwiftIfConfig
1616// Needed to use BumpPtrAllocator
17- @_spi ( BumpPtrAllocator) @_spi ( RawSyntax) import SwiftSyntax
17+ @_spi ( BumpPtrAllocator) @_spi ( RawSyntax) @ _spi ( Compiler ) import SwiftSyntax
1818
1919import struct SwiftDiagnostics. Diagnostic
2020
@@ -422,6 +422,7 @@ public func buildTopLevelASTNodes(
422422 diagEngine: BridgedDiagnosticEngine ,
423423 sourceFilePtr: UnsafeMutableRawPointer ,
424424 dc: BridgedDeclContext ,
425+ attachedDecl: BridgedNullableDecl ,
425426 ctx: BridgedASTContext ,
426427 outputContext: UnsafeMutableRawPointer ,
427428 callback: @convention ( c) ( BridgedASTNode , UnsafeMutableRawPointer ) -> Void
@@ -440,10 +441,28 @@ public func buildTopLevelASTNodes(
440441 for elem in visitor. generate ( sourceFile: node) {
441442 callback ( elem, outputContext)
442443 }
443- case . memberBlockItemList( let node) :
444- for elem in visitor. generate ( memberBlockItemList: node) {
444+
445+ case . memberBlockItemListFile( let node) :
446+ for elem in visitor. generate ( memberBlockItemList: node. members) {
445447 callback ( . decl( elem) , outputContext)
446448 }
449+
450+ case . codeBlockFile( let node) :
451+ let block = visitor. generate ( codeBlock: node. body)
452+ callback ( . stmt( block. asStmt) , outputContext)
453+
454+ case . attributeClauseFile( let node) :
455+ let decl = visitor. generate ( generatedAttributeClauseFile: node)
456+ callback ( . decl( decl) , outputContext)
457+
458+ case . accessorBlockFile( let node) :
459+ // For 'accessor' macro, 'attachedDecl' must be a 'AbstractStorageDecl'.
460+ let storage = BridgedAbstractStorageDecl ( raw: attachedDecl. raw!)
461+
462+ for elem in visitor. generate ( accessorBlockFile: node, for: storage) {
463+ callback ( . decl( elem. asDecl) , outputContext)
464+ }
465+
447466 default :
448467 fatalError ( " invalid syntax for a source file " )
449468 }
0 commit comments