File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Sources/SwiftCompilerPlugin Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -60,11 +60,17 @@ extension CompilerPlugin {
6060
6161 switch macroDefinition {
6262 case let exprMacroDef as ExpressionMacro . Type :
63- let rewritten = try exprMacroDef. expansion ( of: macroSyntax, in: context)
63+ func _expand< Node: FreestandingMacroExpansionSyntax > ( node: Node ) throws -> ExprSyntax {
64+ try exprMacroDef. expansion ( of: node, in: context)
65+ }
66+ let rewritten = try _openExistential ( macroSyntax, do: _expand)
6467 expandedSource = rewritten. description
6568
6669 case let declMacroDef as DeclarationMacro . Type :
67- let rewritten = try declMacroDef. expansion ( of: macroSyntax, in: context)
70+ func _expand< Node: FreestandingMacroExpansionSyntax > ( node: Node ) throws -> [ DeclSyntax ] {
71+ try declMacroDef. expansion ( of: node, in: context)
72+ }
73+ let rewritten = try _openExistential ( macroSyntax, do: _expand)
6874 expandedSource = CodeBlockItemListSyntax ( rewritten. map { CodeBlockItemSyntax ( item: . decl( $0) ) } ) . description
6975
7076 default :
You can’t perform that action at this time.
0 commit comments