Commit 5824002
committed
Fix trivia transfer bugs for freestanding expression macros
There were two bugs in the way we transferred trivia from the original macro expansion expression to the expanded expression.
1. We were attaching the stripped leading trivia to the end of the node
2. We weren’t resetting the `lineContainedComment` and `lineContainedNonWhitespaceNonComment` variables when seeing a newline in a comment-only line
(1) is easy to fix.
For (2), I just remove the entire comment-handling logic because it didn’t match what “Inline Macro” was doing anyway.
rdar://1136390971 parent e030d7a commit 5824002
File tree
3 files changed
+44
-49
lines changed- Sources/SwiftSyntaxMacroExpansion
- Tests/SwiftSyntaxMacroExpansionTest
3 files changed
+44
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
947 | 947 | | |
948 | 948 | | |
949 | 949 | | |
950 | | - | |
| 950 | + | |
951 | 951 | | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
959 | 960 | | |
960 | | - | |
| 961 | + | |
961 | 962 | | |
962 | 963 | | |
963 | 964 | | |
| |||
972 | 973 | | |
973 | 974 | | |
974 | 975 | | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
704 | 723 | | |
705 | 724 | | |
706 | 725 | | |
| |||
709 | 728 | | |
710 | 729 | | |
711 | 730 | | |
712 | | - | |
| 731 | + | |
713 | 732 | | |
714 | 733 | | |
715 | 734 | | |
| |||
1441 | 1460 | | |
1442 | 1461 | | |
1443 | 1462 | | |
| 1463 | + | |
1444 | 1464 | | |
1445 | 1465 | | |
1446 | 1466 | | |
1447 | | - | |
| 1467 | + | |
1448 | 1468 | | |
1449 | 1469 | | |
1450 | 1470 | | |
| |||
1464 | 1484 | | |
1465 | 1485 | | |
1466 | 1486 | | |
| 1487 | + | |
1467 | 1488 | | |
1468 | 1489 | | |
1469 | 1490 | | |
1470 | | - | |
| 1491 | + | |
1471 | 1492 | | |
1472 | 1493 | | |
1473 | 1494 | | |
| |||
0 commit comments