|
13 | 13 | import SwiftSyntax |
14 | 14 | import SwiftSyntaxMacros |
15 | 15 | import SwiftDiagnostics |
16 | | -import _StringProcessing // for String.contains(_:) |
17 | 16 |
|
18 | 17 | public enum DebugDescriptionMacro {} |
19 | 18 | public enum _DebugDescriptionPropertyMacro {} |
@@ -51,18 +50,6 @@ extension DebugDescriptionMacro: MemberAttributeMacro { |
51 | 50 | return [] |
52 | 51 | } |
53 | 52 |
|
54 | | - // Expansion is performed multiple times. Exit early to avoid emitting duplicate macros, |
55 | | - // which leads to duplicate symbol errors. To distinguish been invocations, inspect the |
56 | | - // current mangled name. This ignores the invocation that adds a "__vg" suffix to the member |
57 | | - // name, ex "description__vg". See https://github.com/apple/swift/pull/65559. |
58 | | - let mangledName = context.makeUniqueName("").text |
59 | | - let substring = "\(propertyName)__vg" |
60 | | - // Ex: "15description__vg" |
61 | | - let runlengthSubstring = "\(substring.count)\(substring)" |
62 | | - guard !mangledName.hasSubstring(runlengthSubstring) else { |
63 | | - return [] |
64 | | - } |
65 | | - |
66 | 53 | var properties: [String: PatternBindingSyntax] = [:] |
67 | 54 | for member in declaration.memberBlock.members { |
68 | 55 | for binding in member.decl.as(VariableDeclSyntax.self)?.bindings ?? [] { |
@@ -501,18 +488,3 @@ extension Collection { |
501 | 488 | count == 1 ? first : nil |
502 | 489 | } |
503 | 490 | } |
504 | | - |
505 | | -extension String { |
506 | | - fileprivate func hasSubstring(_ substring: String) -> Bool { |
507 | | - if #available(macOS 13, *) { |
508 | | - return self.contains(substring) |
509 | | - } |
510 | | - |
511 | | - for index in self.indices { |
512 | | - if self.suffix(from: index).hasPrefix(substring) { |
513 | | - return true |
514 | | - } |
515 | | - } |
516 | | - return false |
517 | | - } |
518 | | -} |
0 commit comments