File tree Expand file tree Collapse file tree 2 files changed +4
-15
lines changed Expand file tree Collapse file tree 2 files changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,9 @@ public struct AddExtensionMacro: ExtensionMacro {
41
41
conformingTo protocols: [ TypeSyntax ] ,
42
42
in context: some MacroExpansionContext
43
43
) throws -> [ ExtensionDeclSyntax ] {
44
- let typeName = declaration. declGroupName
45
44
return protocols. map {
46
45
( """
47
- extension \( typeName ) : \( $0) {
46
+ extension \( type . trimmed ) : \( $0) {
48
47
struct _Extension_ \( $0) : \( $0) {
49
48
var nested = 8
50
49
}
@@ -53,8 +52,8 @@ public struct AddExtensionMacro: ExtensionMacro {
53
52
. cast ( ExtensionDeclSyntax . self)
54
53
} + [
55
54
( """
56
- extension \( typeName ) {
57
- static let _extension_ \( typeName ) = 3
55
+ extension \( type . trimmed ) {
56
+ static let _extension_ \( declaration . declGroupName ) = 3
58
57
}
59
58
""" as DeclSyntax ) . cast ( ExtensionDeclSyntax . self)
60
59
]
Original file line number Diff line number Diff line change @@ -40,10 +40,9 @@ public struct AddExtensionMacro: ExtensionMacro {
40
40
conformingTo protocols: [ TypeSyntax ] ,
41
41
in context: some MacroExpansionContext
42
42
) throws -> [ ExtensionDeclSyntax ] {
43
- let typeName = declaration. declGroupName
44
43
return protocols. map {
45
44
( """
46
- extension \( typeName ) : \( $0) {
45
+ extension \( type . trimmed ) : \( $0) {
47
46
struct _Extension_ \( $0) : \( $0) {}
48
47
}
49
48
""" as DeclSyntax )
@@ -66,12 +65,3 @@ extension DeclSyntaxProtocol {
66
65
fatalError ( " Not implemented " )
67
66
}
68
67
}
69
-
70
- extension DeclGroupSyntax {
71
- var declGroupName : TokenSyntax {
72
- if let structDecl = self . as ( StructDeclSyntax . self) {
73
- return structDecl. name. trimmed
74
- }
75
- fatalError ( " Not implemented " )
76
- }
77
- }
You can’t perform that action at this time.
0 commit comments