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 {
4646 ]
4747
4848 let source = SourceFileSyntax {
49- StructDeclSyntax ( identifier : " Person " ) {
49+ StructDeclSyntax ( name : " Person " ) {
5050 for (propertyName, propertyType) in properties {
5151 DeclSyntax ( " var \( raw: propertyName) : \( raw: propertyType) " )
5252
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ struct MetadataMacro: MemberMacro {
3737 providingMembersOf declaration: Declaration ,
3838 in context: Context
3939 ) throws -> [ DeclSyntax ] {
40- guard let type = declaration. asProtocol ( IdentifiedDeclSyntax . self) else {
40+ guard let type = declaration. asProtocol ( NamedDeclSyntax . self) else {
4141 return [ ]
4242 }
43- let typeName = type. identifier . trimmedDescription
43+ let typeName = type. name . trimmedDescription
4444 return [
4545 """
4646 static var __metadata__: [String: String] { [ " name " : " \( raw: typeName) " ] }
@@ -56,10 +56,10 @@ struct PeerValueWithSuffixNameMacro: PeerMacro {
5656 providingPeersOf declaration: some DeclSyntaxProtocol ,
5757 in context: some MacroExpansionContext
5858 ) throws -> [ DeclSyntax ] {
59- guard let identified = declaration. asProtocol ( IdentifiedDeclSyntax . self) else {
59+ guard let identified = declaration. asProtocol ( NamedDeclSyntax . self) else {
6060 return [ ]
6161 }
62- return [ " var \( raw: identified. identifier . text) _peer: Int { 1 } " ]
62+ return [ " var \( raw: identified. name . text) _peer: Int { 1 } " ]
6363 }
6464}
6565
You can’t perform that action at this time.
0 commit comments