Skip to content

Commit 9d1393f

Browse files
committed
Use UnlabeledChildren
1 parent 51f14c4 commit 9d1393f

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Sources/SwiftSyntax/Syntax.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,7 @@ public struct TokenSequence: Sequence {
682682

683683
extension TokenSequence: CustomReflectable {
684684
public var customMirror: Mirror {
685-
let keyAndValues = enumerated().map { (label: String($0.0) as String?, value: $0.1 as Any) }
686-
return Mirror(self, children: keyAndValues)
685+
return Mirror(self, unlabeledChildren: self.map{ $0 })
687686
}
688687
}
689688

@@ -731,7 +730,6 @@ public struct ReversedTokenSequence: Sequence {
731730

732731
extension ReversedTokenSequence: CustomReflectable {
733732
public var customMirror: Mirror {
734-
let keyAndValues = enumerated().map { (label: String($0.0) as String?, value: $0.1 as Any) }
735-
return Mirror(self, children: keyAndValues)
733+
return Mirror(self, unlabeledChildren: self.map{ $0 })
736734
}
737735
}

Sources/SwiftSyntax/SyntaxCollections.swift.gyb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ extension ${node.name}: Sequence {
230230
% if node.is_syntax_collection():
231231
extension ${node.name}: CustomReflectable {
232232
public var customMirror: Mirror {
233-
let keyAndValues = enumerated().map { (label: String($0.0) as String?, value: $0.1 as Any) }
234-
return Mirror(self, children: keyAndValues)
233+
return Mirror(self, unlabeledChildren: self.map{ $0 })
235234
}
236235
}
237236
% end

0 commit comments

Comments
 (0)