Skip to content

Commit f065db6

Browse files
authored
Merge pull request #2057 from Matejkob/deprecation-waringins-in-exaples-package
Fix deprecation warning in `Examples` package
2 parents 044d4b1 + fc59f24 commit f065db6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Examples/Sources/CodeGenerationUsingSwiftSyntaxBuilder/CodeGenerationUsingSwiftSyntaxBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

Examples/Sources/ExamplePlugin/Macros.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)