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 {
60
60
61
61
switch macroDefinition {
62
62
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)
64
67
expandedSource = rewritten. description
65
68
66
69
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)
68
74
expandedSource = CodeBlockItemListSyntax ( rewritten. map { CodeBlockItemSyntax ( item: . decl( $0) ) } ) . description
69
75
70
76
default :
You can’t perform that action at this time.
0 commit comments