Commit 4eb805c
committed
Improve debug description of syntax nodes
This improves the description generated by the `debugDescription` function to something like the following which is easier to read IMO
```
SourceFileSyntax
├─CodeBlockItemListSyntax
│ ╰─CodeBlockItemSyntax
│ ╰─MacroExpansionExprSyntax
│ ├─pound
│ ├─identifier("stringify")
│ ├─leftParen
│ ├─TupleExprElementListSyntax
│ │ ╰─TupleExprElementSyntax
│ │ ╰─InfixOperatorExprSyntax
│ │ ├─IntegerLiteralExprSyntax
│ │ │ ╰─integerLiteral("2")
│ │ ├─BinaryOperatorExprSyntax
│ │ │ ╰─binaryOperator("+")
│ │ ╰─IntegerLiteralExprSyntax
│ │ ╰─integerLiteral("3")
│ ╰─rightParen
╰─eof
```
Since we now have this nice representation, it also removes the conformances to `CustomReflectable` (deleting 3000 lines of code :hooray:) and doing some new `CustomReflectable` hackery to make the debugger just print `debugDescription` and not try to print the node’s children itself. This way you an now do `po node` in the debugger to get the debug description from above, instead of having to do `e print(node.recursiveDescription)`1 parent ac4f8f3 commit 4eb805c
File tree
17 files changed
+41
-3767
lines changed- CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax
- Sources
- SwiftSyntax
- generated
- syntaxNodes
- _SwiftSyntaxTestSupport
- swift-parser-cli
- Tests
- SwiftParserTest
- SwiftSyntaxTest
17 files changed
+41
-3767
lines changedLines changed: 0 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | 244 | | |
257 | 245 | | |
Lines changed: 0 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | 430 | | |
Lines changed: 0 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 283 | | |
305 | 284 | | |
306 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 111 | | |
120 | 112 | | |
121 | 113 | | |
| |||
161 | 153 | | |
162 | 154 | | |
163 | 155 | | |
164 | | - | |
| 156 | + | |
165 | 157 | | |
166 | 158 | | |
167 | 159 | | |
| |||
598 | 590 | | |
599 | 591 | | |
600 | 592 | | |
601 | | - | |
602 | | - | |
603 | | - | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
604 | 597 | | |
605 | 598 | | |
606 | 599 | | |
607 | 600 | | |
608 | | - | |
609 | 601 | | |
610 | 602 | | |
611 | 603 | | |
| |||
615 | 607 | | |
616 | 608 | | |
617 | 609 | | |
618 | | - | |
619 | 610 | | |
620 | 611 | | |
621 | 612 | | |
622 | | - | |
| 613 | + | |
623 | 614 | | |
624 | 615 | | |
625 | 616 | | |
626 | 617 | | |
627 | | - | |
628 | 618 | | |
629 | 619 | | |
630 | 620 | | |
631 | | - | |
| 621 | + | |
632 | 622 | | |
633 | 623 | | |
634 | 624 | | |
635 | 625 | | |
636 | 626 | | |
637 | 627 | | |
638 | | - | |
639 | 628 | | |
640 | 629 | | |
641 | 630 | | |
642 | | - | |
| 631 | + | |
643 | 632 | | |
644 | 633 | | |
645 | 634 | | |
| |||
660 | 649 | | |
661 | 650 | | |
662 | 651 | | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | 652 | | |
669 | 653 | | |
670 | 654 | | |
| |||
679 | 663 | | |
680 | 664 | | |
681 | 665 | | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
697 | 679 | | |
698 | 680 | | |
699 | 681 | | |
| |||
802 | 784 | | |
803 | 785 | | |
804 | 786 | | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | 787 | | |
815 | 788 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | 156 | | |
165 | 157 | | |
166 | 158 | | |
| |||
326 | 318 | | |
327 | 319 | | |
328 | 320 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | 321 | | |
338 | 322 | | |
339 | 323 | | |
| |||
458 | 442 | | |
459 | 443 | | |
460 | 444 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | 445 | | |
470 | 446 | | |
471 | 447 | | |
| |||
599 | 575 | | |
600 | 576 | | |
601 | 577 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | 578 | | |
611 | 579 | | |
612 | 580 | | |
| |||
740 | 708 | | |
741 | 709 | | |
742 | 710 | | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
0 commit comments