File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
CodeGenerationUsingSwiftSyntaxBuilder Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ struct Main {
46
46
]
47
47
48
48
let source = SourceFileSyntax {
49
- StructDeclSyntax ( identifier : " Person " ) {
49
+ StructDeclSyntax ( name : " Person " ) {
50
50
for (propertyName, propertyType) in properties {
51
51
DeclSyntax ( " var \( raw: propertyName) : \( raw: propertyType) " )
52
52
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ struct MetadataMacro: MemberMacro {
37
37
providingMembersOf declaration: Declaration ,
38
38
in context: Context
39
39
) throws -> [ DeclSyntax ] {
40
- guard let type = declaration. asProtocol ( IdentifiedDeclSyntax . self) else {
40
+ guard let type = declaration. asProtocol ( NamedDeclSyntax . self) else {
41
41
return [ ]
42
42
}
43
- let typeName = type. identifier . trimmedDescription
43
+ let typeName = type. name . trimmedDescription
44
44
return [
45
45
"""
46
46
static var __metadata__: [String: String] { [ " name " : " \( raw: typeName) " ] }
@@ -56,10 +56,10 @@ struct PeerValueWithSuffixNameMacro: PeerMacro {
56
56
providingPeersOf declaration: some DeclSyntaxProtocol ,
57
57
in context: some MacroExpansionContext
58
58
) throws -> [ DeclSyntax ] {
59
- guard let identified = declaration. asProtocol ( IdentifiedDeclSyntax . self) else {
59
+ guard let identified = declaration. asProtocol ( NamedDeclSyntax . self) else {
60
60
return [ ]
61
61
}
62
- return [ " var \( raw: identified. identifier . text) _peer: Int { 1 } " ]
62
+ return [ " var \( raw: identified. name . text) _peer: Int { 1 } " ]
63
63
}
64
64
}
65
65
You can’t perform that action at this time.
0 commit comments