Skip to content

Commit 41cf264

Browse files
committed
🐛 fix wrong locations for filters syntax
1 parent 4cea141 commit 41cf264

File tree

8 files changed

+1188
-89
lines changed

8 files changed

+1188
-89
lines changed

Diff for: src/script/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ export function parseExpression(
680680
ret.references.push(...retF.references)
681681
}
682682

683-
prevLoc += 1 + filterCodes.length
683+
prevLoc += 1 + filterCode.length
684684
}
685685

686686
// Update range.

Diff for: test/fixtures/ast/filters-2/ast.json

+76-76
Original file line numberDiff line numberDiff line change
@@ -194,33 +194,33 @@
194194
{
195195
"type": "VFilter",
196196
"range": [
197-
35,
198-
39
197+
36,
198+
40
199199
],
200200
"loc": {
201201
"start": {
202202
"line": 2,
203-
"column": 24
203+
"column": 25
204204
},
205205
"end": {
206206
"line": 2,
207-
"column": 28
207+
"column": 29
208208
}
209209
},
210210
"callee": {
211211
"type": "Identifier",
212212
"range": [
213-
35,
214-
37
213+
36,
214+
38
215215
],
216216
"loc": {
217217
"start": {
218218
"line": 2,
219-
"column": 24
219+
"column": 25
220220
},
221221
"end": {
222222
"line": 2,
223-
"column": 26
223+
"column": 27
224224
}
225225
},
226226
"name": "f2"
@@ -230,55 +230,55 @@
230230
{
231231
"type": "VFilter",
232232
"range": [
233-
39,
234-
46
233+
43,
234+
50
235235
],
236236
"loc": {
237237
"start": {
238238
"line": 2,
239-
"column": 28
239+
"column": 32
240240
},
241241
"end": {
242242
"line": 2,
243-
"column": 35
243+
"column": 39
244244
}
245245
},
246246
"callee": {
247247
"type": "Identifier",
248248
"range": [
249-
39,
250-
41
249+
43,
250+
45
251251
],
252252
"loc": {
253253
"start": {
254254
"line": 2,
255-
"column": 28
255+
"column": 32
256256
},
257257
"end": {
258258
"line": 2,
259-
"column": 30
259+
"column": 34
260260
}
261261
},
262262
"name": "f3"
263263
},
264264
"arguments": [
265265
{
266266
"type": "Identifier",
267-
"start": 42,
268-
"end": 45,
267+
"start": 46,
268+
"end": 49,
269269
"loc": {
270270
"start": {
271271
"line": 2,
272-
"column": 31
272+
"column": 35
273273
},
274274
"end": {
275275
"line": 2,
276-
"column": 34
276+
"column": 38
277277
}
278278
},
279279
"range": [
280-
42,
281-
45
280+
46,
281+
49
282282
],
283283
"name": "ref"
284284
}
@@ -287,7 +287,7 @@
287287
],
288288
"range": [
289289
23,
290-
46
290+
50
291291
],
292292
"loc": {
293293
"start": {
@@ -296,7 +296,7 @@
296296
},
297297
"end": {
298298
"line": 2,
299-
"column": 35
299+
"column": 39
300300
}
301301
}
302302
},
@@ -327,21 +327,21 @@
327327
{
328328
"id": {
329329
"type": "Identifier",
330-
"start": 42,
331-
"end": 45,
330+
"start": 46,
331+
"end": 49,
332332
"loc": {
333333
"start": {
334334
"line": 2,
335-
"column": 31
335+
"column": 35
336336
},
337337
"end": {
338338
"line": 2,
339-
"column": 34
339+
"column": 38
340340
}
341341
},
342342
"range": [
343-
42,
344-
45
343+
46,
344+
49
345345
],
346346
"name": "ref"
347347
},
@@ -575,172 +575,172 @@
575575
"type": "Punctuator",
576576
"value": "|",
577577
"range": [
578-
33,
579-
34
578+
34,
579+
35
580580
],
581581
"loc": {
582582
"start": {
583583
"line": 2,
584-
"column": 22
584+
"column": 23
585585
},
586586
"end": {
587587
"line": 2,
588-
"column": 23
588+
"column": 24
589589
}
590590
}
591591
},
592592
{
593593
"type": "Identifier",
594594
"value": " f2",
595595
"range": [
596-
35,
597-
37
596+
36,
597+
38
598598
],
599599
"loc": {
600600
"start": {
601601
"line": 2,
602-
"column": 24
602+
"column": 25
603603
},
604604
"end": {
605605
"line": 2,
606-
"column": 26
606+
"column": 27
607607
}
608608
}
609609
},
610610
{
611611
"type": "Punctuator",
612612
"value": "(",
613-
"start": 37,
614-
"end": 38,
613+
"start": 38,
614+
"end": 39,
615615
"loc": {
616616
"start": {
617617
"line": 2,
618-
"column": 26
618+
"column": 27
619619
},
620620
"end": {
621621
"line": 2,
622-
"column": 27
622+
"column": 28
623623
}
624624
},
625625
"range": [
626-
37,
627-
38
626+
38,
627+
39
628628
]
629629
},
630630
{
631631
"type": "Punctuator",
632632
"value": ")",
633-
"start": 38,
634-
"end": 39,
633+
"start": 39,
634+
"end": 40,
635635
"loc": {
636636
"start": {
637637
"line": 2,
638-
"column": 27
638+
"column": 28
639639
},
640640
"end": {
641641
"line": 2,
642-
"column": 28
642+
"column": 29
643643
}
644644
},
645645
"range": [
646-
38,
647-
39
646+
39,
647+
40
648648
]
649649
},
650650
{
651651
"type": "Punctuator",
652652
"value": "|",
653653
"range": [
654-
37,
655-
38
654+
41,
655+
42
656656
],
657657
"loc": {
658658
"start": {
659659
"line": 2,
660-
"column": 26
660+
"column": 30
661661
},
662662
"end": {
663663
"line": 2,
664-
"column": 27
664+
"column": 31
665665
}
666666
}
667667
},
668668
{
669669
"type": "Identifier",
670670
"value": " f3",
671671
"range": [
672-
39,
673-
41
672+
43,
673+
45
674674
],
675675
"loc": {
676676
"start": {
677677
"line": 2,
678-
"column": 28
678+
"column": 32
679679
},
680680
"end": {
681681
"line": 2,
682-
"column": 30
682+
"column": 34
683683
}
684684
}
685685
},
686686
{
687687
"type": "Punctuator",
688688
"value": "(",
689-
"start": 41,
690-
"end": 42,
689+
"start": 45,
690+
"end": 46,
691691
"loc": {
692692
"start": {
693693
"line": 2,
694-
"column": 30
694+
"column": 34
695695
},
696696
"end": {
697697
"line": 2,
698-
"column": 31
698+
"column": 35
699699
}
700700
},
701701
"range": [
702-
41,
703-
42
702+
45,
703+
46
704704
]
705705
},
706706
{
707707
"type": "Identifier",
708708
"value": "ref",
709-
"start": 42,
710-
"end": 45,
709+
"start": 46,
710+
"end": 49,
711711
"loc": {
712712
"start": {
713713
"line": 2,
714-
"column": 31
714+
"column": 35
715715
},
716716
"end": {
717717
"line": 2,
718-
"column": 34
718+
"column": 38
719719
}
720720
},
721721
"range": [
722-
42,
723-
45
722+
46,
723+
49
724724
]
725725
},
726726
{
727727
"type": "Punctuator",
728728
"value": ")",
729-
"start": 45,
730-
"end": 46,
729+
"start": 49,
730+
"end": 50,
731731
"loc": {
732732
"start": {
733733
"line": 2,
734-
"column": 34
734+
"column": 38
735735
},
736736
"end": {
737737
"line": 2,
738-
"column": 35
738+
"column": 39
739739
}
740740
},
741741
"range": [
742-
45,
743-
46
742+
49,
743+
50
744744
]
745745
},
746746
{

0 commit comments

Comments
 (0)