seaofvoices / darklua

A command line tool that transforms Lua code
https://darklua.com/
MIT License
78 stars 10 forks source link

Fix empty AST with trivia tokens #132

Closed jeparlefrancais closed 10 months ago

jeparlefrancais commented 10 months ago

When converting an empty AST with comments or spaces, this information was previously lost. Now, it is retained in the final_token block tokens.

github-actions[bot] commented 10 months ago

Coverage after merging fix-empty-block-with-trivia into main will be

87.06%

Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines
src
   ast_converter.rs87.72%100%88.57%87.68%1003, 1022, 1052, 1076, 1093, 1125–1127, 1142, 1170, 1212, 1227, 1243–1245, 1255, 1260–1262, 1277, 1288, 1418–1420, 1481–1483, 1534–1536, 1560–1563, 1598–1600, 1628–1630, 1634–1636, 1699–1700, 1729–1731, 1738–1740, 1759–1761, 1777–1779, 1784–1786, 1847, 1852–1854, 1874, 1880–1882, 1887–1889, 1922–1927, 1951–1953, 1979, 2042, 2060–2062, 2098–2100, 2106–2109, 2139, 2153, 2157–2159, 218–220, 2213–2215, 2227–2229, 2233–2235, 2269, 235, 2352–2354, 236–237, 2374–2376, 2397–2399, 2429–2431, 2447, 2451, 2474–2476, 2488–2490, 2509–2511, 2566–2568, 2575, 265–267, 2765, 2838–2845, 2847–2854, 2856–2866, 2875, 2877–2882, 2885, 2910–2912, 2923–2925, 2942–2944, 485, 500–502, 537–539, 547, 561, 577–579, 581–582, 584–586, 599–601, 605, 614–616, 657, 668–670, 676–678, 683–686, 697, 721, 808, 812–814, 897, 921, 933, 965, 982, 986–989
   parser.rs99.27%100%74.19%99.54%37, 43, 55–59, 66
src/generator
   token_based.rs89.66%100%92.90%89.37%10, 1000–1009, 1012, 1014–1023, 1026–1027, 1043–1044, 1058–1060, 1074–1076, 1085–1087, 1096–1098, 1107–1109, 113, 1258, 130–131, 1328, 1365–1373, 1455–1464, 147–148, 1489–1491, 1493–1495, 1512–1521, 1596, 160–161, 182–183, 203–204, 2041–2042, 205, 2068–2072, 2101–2105, 2112–2116, 2318, 2322, 2335, 245, 297–301, 373–374, 380, 392, 426–427, 449–450, 466–467, 509, 582–583, 592–593, 599–600, 606, 618, 644–645, 678–679, 727–729, 747–748, 774–775, 784–785, 791–792, 798, 80, 810, 832–836, 84, 877–878, 938–945, 960–961, 970–971, 978, 991–998
src/nodes
   block.rs96.44%100%98.82%95.99%16, 19, 231–236, 25–26, 28, 31, 40, 49–50, 52, 55
   token.rs96.36%100%97.78%96.04%194, 200–202, 68, 77, 90