Skip to content

Commit 0edf34c

Browse files
Updated type arguments implementation (#2925)
1 parent 25e7822 commit 0edf34c

File tree

7 files changed

+115
-117
lines changed

7 files changed

+115
-117
lines changed

data/fixtures/scopes/java/type.field.scope

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,32 @@ class MyClass {
3939

4040

4141
[#3 Content] =
42-
[#3 Removal] =
4342
[#3 Domain] = 1:8-1:11
4443
>---<
4544
1| Map<int, int> foo;
4645

47-
[#3 Insertion delimiter] = " "
46+
[#3 Removal] = 1:8-1:13
47+
>-----<
48+
1| Map<int, int> foo;
49+
50+
[#3 Trailing delimiter] = 1:11-1:13
51+
>--<
52+
1| Map<int, int> foo;
53+
54+
[#3 Insertion delimiter] = ", "
4855

4956

5057
[#4 Content] =
5158
[#4 Domain] = 1:13-1:16
5259
>---<
5360
1| Map<int, int> foo;
5461

55-
[#4 Removal] = 1:12-1:16
56-
>----<
62+
[#4 Removal] = 1:11-1:16
63+
>-----<
5764
1| Map<int, int> foo;
5865

59-
[#4 Leading delimiter] = 1:12-1:13
60-
>-<
66+
[#4 Leading delimiter] = 1:11-1:13
67+
>--<
6168
1| Map<int, int> foo;
6269

63-
[#4 Insertion delimiter] = " "
70+
[#4 Insertion delimiter] = ", "
Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
class MyClass {
2-
Map<int, int> foo;
3-
}
1+
Map<int, int> foo;
42
---
53

6-
[#1 Range] =
7-
[#1 Domain] = 0:15-2:0
8-
>
9-
0| class MyClass {
10-
1| Map<int, int> foo;
11-
2| }
12-
<
13-
14-
15-
[#2 Range] =
16-
[#2 Domain] = 1:8-1:16
17-
>--------<
18-
1| Map<int, int> foo;
4+
[Range] =
5+
[Domain] = 0:4-0:12
6+
>--------<
7+
0| Map<int, int> foo;
Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,52 @@
1-
class MyClass {
2-
Map<int, int> foo;
3-
}
1+
Map<int, int> foo;
42
---
53

6-
[#1 Content] =
7-
[#1 Removal] =
8-
[#1 Domain] = 0:0-2:1
9-
>---------------
10-
0| class MyClass {
11-
1| Map<int, int> foo;
12-
2| }
13-
-<
4+
[#1 Content] = 0:0-0:13
5+
>-------------<
6+
0| Map<int, int> foo;
147

15-
[#1 Insertion delimiter] = " "
16-
17-
18-
[#2 Content] = 1:4-1:17
19-
>-------------<
20-
1| Map<int, int> foo;
8+
[#1 Removal] = 0:0-0:14
9+
>--------------<
10+
0| Map<int, int> foo;
2111

22-
[#2 Removal] = 1:4-1:18
23-
>--------------<
24-
1| Map<int, int> foo;
12+
[#1 Trailing delimiter] = 0:13-0:14
13+
>-<
14+
0| Map<int, int> foo;
2515

26-
[#2 Leading delimiter] = 1:0-1:4
27-
>----<
28-
1| Map<int, int> foo;
16+
[#1 Domain] = 0:0-0:18
17+
>------------------<
18+
0| Map<int, int> foo;
2919

30-
[#2 Trailing delimiter] = 1:17-1:18
31-
>-<
32-
1| Map<int, int> foo;
20+
[#1 Insertion delimiter] = " "
3321

34-
[#2 Domain] = 1:4-1:22
35-
>------------------<
36-
1| Map<int, int> foo;
3722

38-
[#2 Insertion delimiter] = " "
23+
[#2 Content] =
24+
[#2 Domain] = 0:4-0:7
25+
>---<
26+
0| Map<int, int> foo;
3927

28+
[#2 Removal] = 0:4-0:9
29+
>-----<
30+
0| Map<int, int> foo;
4031

41-
[#3 Content] =
42-
[#3 Removal] =
43-
[#3 Domain] = 1:8-1:11
44-
>---<
45-
1| Map<int, int> foo;
32+
[#2 Trailing delimiter] = 0:7-0:9
33+
>--<
34+
0| Map<int, int> foo;
4635

47-
[#3 Insertion delimiter] = " "
36+
[#2 Insertion delimiter] = ", "
4837

4938

50-
[#4 Content] =
51-
[#4 Domain] = 1:13-1:16
52-
>---<
53-
1| Map<int, int> foo;
39+
[#3 Content] =
40+
[#3 Domain] = 0:9-0:12
41+
>---<
42+
0| Map<int, int> foo;
5443

55-
[#4 Removal] = 1:12-1:16
56-
>----<
57-
1| Map<int, int> foo;
44+
[#3 Removal] = 0:7-0:12
45+
>-----<
46+
0| Map<int, int> foo;
5847

59-
[#4 Leading delimiter] = 1:12-1:13
60-
>-<
61-
1| Map<int, int> foo;
48+
[#3 Leading delimiter] = 0:7-0:9
49+
>--<
50+
0| Map<int, int> foo;
6251

63-
[#4 Insertion delimiter] = " "
52+
[#3 Insertion delimiter] = ", "

data/fixtures/scopes/typescript.core/type.typeArgument.scope

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,32 @@ let value: Map<string, number>;
2121

2222

2323
[#2 Content] =
24-
[#2 Removal] =
2524
[#2 Domain] = 0:15-0:21
2625
>------<
2726
0| let value: Map<string, number>;
2827

29-
[#2 Insertion delimiter] = " "
28+
[#2 Removal] = 0:15-0:23
29+
>--------<
30+
0| let value: Map<string, number>;
31+
32+
[#2 Trailing delimiter] = 0:21-0:23
33+
>--<
34+
0| let value: Map<string, number>;
35+
36+
[#2 Insertion delimiter] = ", "
3037

3138

3239
[#3 Content] =
3340
[#3 Domain] = 0:23-0:29
3441
>------<
3542
0| let value: Map<string, number>;
3643

37-
[#3 Removal] = 0:22-0:29
38-
>-------<
44+
[#3 Removal] = 0:21-0:29
45+
>--------<
3946
0| let value: Map<string, number>;
4047

41-
[#3 Leading delimiter] = 0:22-0:23
42-
>-<
48+
[#3 Leading delimiter] = 0:21-0:23
49+
>--<
4350
0| let value: Map<string, number>;
4451

45-
[#3 Insertion delimiter] = " "
52+
[#3 Insertion delimiter] = ", "
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
useState<string>()
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:9-0:15
7+
>------<
8+
0| useState<string>()
9+
10+
[Insertion delimiter] = ", "

queries/java.scm

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,6 @@
306306
.
307307
) @type.iteration.domain @name.iteration.domain
308308

309-
;;!! Map<String, String>
310-
;;! ^^^^^^^ ^^^^^^
311-
(type_arguments
312-
(type_identifier) @type
313-
)
314-
315309
;;!! List<String> list = value;
316310
;;! ^^^^^^^^^^^^
317311
;;! --------------------------
@@ -480,21 +474,26 @@
480474
(#not-type? @value block)
481475
) @_.domain
482476

483-
;;!! public Map<int, int> foo;
484-
;;! ^^^^^^^^^^^^^
485-
;;! -------------------------
477+
;;!! Map<int, int> foo;
478+
;;! ^^^^^^^^^^^^^
479+
;;! ------------------
486480
(field_declaration
487481
type: (_) @type
488482
) @_.domain
489483

490-
;;!! public Map<int, int> foo;
491-
;;! ^^^ ^^^
484+
;;!! Map<int, int> foo;
485+
;;! ^^^ ^^^
492486
(type_arguments
487+
(_)? @_.leading.endOf
488+
.
493489
(_) @type
490+
.
491+
(_)? @_.trailing.startOf
492+
(#insertion-delimiter! @type ", ")
494493
)
495494

496-
;;!! public Map<int, int> foo;
497-
;;! ^^^^^^^^
495+
;;!! Map<int, int> foo;
496+
;;! ^^^^^^^^
498497
(type_arguments
499498
.
500499
"<" @type.iteration.start.endOf

queries/typescript.core.scm

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,33 @@
263263
type_arguments: (_)? @type.end
264264
)
265265

266+
;;!! Map<string, number>
267+
;;! ^^^^^^ ^^^^^^
266268
;;!! useState<string>()
267269
;;! ^^^^^^
268-
;;!! useState<Record<string, string>>()
269-
;;! ^^^^^^^^^^^^^^^^^^^^^^
270-
;;! ^^^^^^ ^^^^^^
271-
(type_arguments
272-
(_) @type
270+
(
271+
(type_arguments
272+
(_)? @_.leading.endOf
273+
.
274+
(_) @type
275+
.
276+
(_)? @_.trailing.startOf
277+
) @_dummy
278+
(#not-parent-type? @_dummy type_assertion)
279+
(#insertion-delimiter! @type ", ")
280+
)
281+
282+
;;!! Map<string, number>
283+
;;! ^^^^^^^^^^^^^^
284+
(
285+
(type_arguments
286+
.
287+
"<" @type.iteration.start.endOf
288+
">" @type.iteration.end.startOf
289+
.
290+
) @_dummy
273291
(#not-parent-type? @_dummy type_assertion)
274-
) @_dummy
292+
)
275293

276294
;;!! function foo<A>() {}
277295
;;! ^
@@ -414,24 +432,3 @@
414432
"}" @type.iteration.end.startOf
415433
.
416434
)
417-
418-
;;!! Map<string, number>
419-
;;! ^^^^^^ ^^^^^^
420-
(
421-
(type_arguments
422-
(_) @type
423-
) @_dummy
424-
(#not-parent-type? @_dummy type_assertion)
425-
)
426-
427-
;;!! Map<string, number>
428-
;;! ^^^^^^^^^^^^^^
429-
(
430-
(type_arguments
431-
.
432-
"<" @type.iteration.start.endOf
433-
">" @type.iteration.end.startOf
434-
.
435-
) @_dummy
436-
(#not-parent-type? @_dummy type_assertion)
437-
)

0 commit comments

Comments
 (0)