Commit c878e73
committed
Unified: Add locations for blocks
Blocks are slightly awkward, since we destructure them (as codeBlock) in
the query, and then reconstruct them (as `block`) in the rule body,
meaning the location of the block is (by default) assigned to the wrong
place by the heuristic.
To get around this, I added a helper function that updates the location
appropriately, including handling cases where we only optionally match a
block. (Also, in some cases we can fix this by just not destructuring
`codeBlock`s in the first place -- there's already a rule that maps
`codeBlock` to `block`.)1 parent c21bba7 commit c878e73
8 files changed
Lines changed: 51 additions & 17 deletions
File tree
- unified/extractor
- src/languages/swift
- tests
- corpus/swift
- expressions
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
63 | 77 | | |
64 | 78 | | |
65 | 79 | | |
| |||
301 | 315 | | |
302 | 316 | | |
303 | 317 | | |
304 | | - | |
| 318 | + | |
305 | 319 | | |
306 | 320 | | |
307 | 321 | | |
308 | 322 | | |
309 | 323 | | |
310 | | - | |
311 | | - | |
| 324 | + | |
| 325 | + | |
312 | 326 | | |
313 | 327 | | |
314 | 328 | | |
| |||
564 | 578 | | |
565 | 579 | | |
566 | 580 | | |
567 | | - | |
| 581 | + | |
568 | 582 | | |
569 | 583 | | |
570 | 584 | | |
571 | 585 | | |
572 | 586 | | |
573 | 587 | | |
574 | 588 | | |
575 | | - | |
| 589 | + | |
576 | 590 | | |
577 | 591 | | |
578 | 592 | | |
| |||
747 | 761 | | |
748 | 762 | | |
749 | 763 | | |
750 | | - | |
| 764 | + | |
751 | 765 | | |
752 | 766 | | |
753 | 767 | | |
754 | 768 | | |
755 | 769 | | |
756 | 770 | | |
757 | | - | |
| 771 | + | |
758 | 772 | | |
759 | 773 | | |
760 | 774 | | |
| |||
1277 | 1291 | | |
1278 | 1292 | | |
1279 | 1293 | | |
1280 | | - | |
| 1294 | + | |
1281 | 1295 | | |
1282 | 1296 | | |
1283 | 1297 | | |
1284 | 1298 | | |
1285 | | - | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
1286 | 1311 | | |
1287 | 1312 | | |
1288 | 1313 | | |
1289 | 1314 | | |
1290 | 1315 | | |
1291 | | - | |
| 1316 | + | |
1292 | 1317 | | |
1293 | 1318 | | |
1294 | 1319 | | |
1295 | | - | |
| 1320 | + | |
1296 | 1321 | | |
1297 | 1322 | | |
1298 | 1323 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
0 commit comments