@@ -604,14 +604,10 @@ public extension SyntaxProtocol {
604
604
return Mirror ( self , children: [ : ] )
605
605
}
606
606
607
- /// Same as `debugDescription` but includes all children.
608
- var recursiveDescription : String {
609
- debugDescription ( includeChildren: true )
610
- }
611
-
612
607
/// Returns a summarized dump of this node.
613
608
/// - Parameters:
614
- /// - includeChildren: Whether to also dump children, false by default.
609
+ /// - includeChildNames: Add the name of each child before the child itself.
610
+ /// `false` by default.
615
611
/// - includeTrivia: Add trivia to each dumped node, which the default
616
612
/// dump skips.
617
613
/// - converter: The location converter for the root of the tree. Adds
@@ -621,7 +617,7 @@ public extension SyntaxProtocol {
621
617
/// - indentLevel: The starting indent level, 0 by default. Each level is 2
622
618
/// spaces.
623
619
func debugDescription(
624
- includeChildren : Bool = true ,
620
+ includeChildNames : Bool = false ,
625
621
includeTrivia: Bool = false ,
626
622
converter: SourceLocationConverter ? = nil ,
627
623
mark: SyntaxProtocol ? = nil ,
@@ -630,7 +626,6 @@ public extension SyntaxProtocol {
630
626
var str = " "
631
627
debugWrite (
632
628
to: & str,
633
- includeChildren: includeChildren,
634
629
includeTrivia: includeTrivia,
635
630
converter: converter,
636
631
mark: mark,
@@ -641,7 +636,6 @@ public extension SyntaxProtocol {
641
636
642
637
private func debugWrite< Target: TextOutputStream > (
643
638
to target: inout Target ,
644
- includeChildren: Bool ,
645
639
includeTrivia: Bool ,
646
640
converter: SourceLocationConverter ? = nil ,
647
641
mark: SyntaxProtocol ? = nil ,
@@ -680,22 +674,22 @@ public extension SyntaxProtocol {
680
674
target. write ( " *** " )
681
675
}
682
676
683
- if includeChildren {
684
- for (num, child) in allChildren. enumerated ( ) {
685
- let isLastChild = num == allChildren. count - 1
686
- target. write ( " \n " )
687
- target. write ( indentString)
688
- target. write ( isLastChild ? " ╰─ " : " ├─ " )
689
- let childIndentString = indentString + ( isLastChild ? " " : " │ " )
690
- child. debugWrite (
691
- to: & target,
692
- includeChildren: includeChildren,
693
- includeTrivia: includeTrivia,
694
- converter: converter,
695
- mark: mark,
696
- indentString: childIndentString
697
- )
677
+ for (num, child) in allChildren. enumerated ( ) {
678
+ let isLastChild = num == allChildren. count - 1
679
+ target. write ( " \n " )
680
+ target. write ( indentString)
681
+ target. write ( isLastChild ? " ╰─ " : " ├─ " )
682
+ let childIndentString = indentString + ( isLastChild ? " " : " │ " )
683
+ if case . layout( let layout) = type ( of: child) . structure {
684
+ target. write ( " \( layout [ num] ) : " )
698
685
}
686
+ child. debugWrite (
687
+ to: & target,
688
+ includeTrivia: includeTrivia,
689
+ converter: converter,
690
+ mark: mark,
691
+ indentString: childIndentString
692
+ )
699
693
}
700
694
}
701
695
}
@@ -804,14 +798,14 @@ extension ReversedTokenSequence: CustomReflectable {
804
798
}
805
799
}
806
800
807
- /// Expose `recursiveDescription` on raw nodes for debugging purposes.
808
- extension RawSyntaxNodeProtocol {
809
- /// Print this raw syntax node including all of its children.
810
- /// Intended for debugging purposes only.
811
- var recursiveDescription : String {
812
- return Syntax ( raw: raw) . recursiveDescription
813
- }
814
- }
801
+ ///// Expose `recursiveDescription` on raw nodes for debugging purposes.
802
+ // extension RawSyntaxNodeProtocol {
803
+ // /// Print this raw syntax node including all of its children.
804
+ // /// Intended for debugging purposes only.
805
+ // var recursiveDescription: String {
806
+ // return Syntax(raw: raw).recursiveDescription
807
+ // }
808
+ // }
815
809
816
810
@available ( * , unavailable, message: " use 'Syntax' instead " )
817
811
public struct SyntaxNode { }
0 commit comments