Skip to content

Commit 5bc3511

Browse files
Type scope
1 parent 718d701 commit 5bc3511

File tree

9 files changed

+155
-29
lines changed

9 files changed

+155
-29
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
void foo(int aaa) {}
2+
---
3+
4+
[#1 Content] = 0:0-0:4
5+
>----<
6+
0| void foo(int aaa) {}
7+
8+
[#1 Removal] = 0:0-0:5
9+
>-----<
10+
0| void foo(int aaa) {}
11+
12+
[#1 Trailing delimiter] = 0:4-0:5
13+
>-<
14+
0| void foo(int aaa) {}
15+
16+
[#1 Domain] = 0:0-0:20
17+
>--------------------<
18+
0| void foo(int aaa) {}
19+
20+
[#1 Insertion delimiter] = " "
21+
22+
23+
[#2 Content] = 0:9-0:12
24+
>---<
25+
0| void foo(int aaa) {}
26+
27+
[#2 Removal] = 0:9-0:13
28+
>----<
29+
0| void foo(int aaa) {}
30+
31+
[#2 Trailing delimiter] = 0:12-0:13
32+
>-<
33+
0| void foo(int aaa) {}
34+
35+
[#2 Domain] = 0:9-0:16
36+
>-------<
37+
0| void foo(int aaa) {}
38+
39+
[#2 Insertion delimiter] = " "
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(int)5.5;
2+
---
3+
4+
[Content] = 0:1-0:4
5+
>---<
6+
0| (int)5.5;
7+
8+
[Removal] = 0:0-0:5
9+
>-----<
10+
0| (int)5.5;
11+
12+
[Domain] = 0:0-0:8
13+
>--------<
14+
0| (int)5.5;
15+
16+
[Insertion delimiter] = " "
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
enum Foo { aaa, bbb };
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:0-0:22
7+
>----------------------<
8+
0| enum Foo { aaa, bbb };
9+
10+
[Insertion delimiter] = " "
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
int foo() {}
2+
---
3+
4+
[Content] = 0:0-0:3
5+
>---<
6+
0| int foo() {}
7+
8+
[Removal] = 0:0-0:4
9+
>----<
10+
0| int foo() {}
11+
12+
[Trailing delimiter] = 0:3-0:4
13+
>-<
14+
0| int foo() {}
15+
16+
[Domain] = 0:0-0:12
17+
>------------<
18+
0| int foo() {}
19+
20+
[Insertion delimiter] = " "
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
int foo = 2;
2+
---
3+
4+
[Content] = 0:0-0:3
5+
>---<
6+
0| int foo = 2;
7+
8+
[Removal] = 0:0-0:4
9+
>----<
10+
0| int foo = 2;
11+
12+
[Trailing delimiter] = 0:3-0:4
13+
>-<
14+
0| int foo = 2;
15+
16+
[Domain] = 0:0-0:12
17+
>------------<
18+
0| int foo = 2;
19+
20+
[Insertion delimiter] = " "

packages/common/src/scopeSupportFacets/c.ts

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = {
1212
namedFunction: supported,
1313

1414
functionName: supported,
15-
"functionName.method": supported,
1615
functionCall: supported,
1716
functionCallee: supported,
1817
"argument.actual": supported,
@@ -42,48 +41,31 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = {
4241

4342
"name.assignment": supported,
4443
"name.variable": supported,
45-
"name.foreach": supported,
4644
"name.function": supported,
47-
"name.method": supported,
48-
"name.constructor": supported,
4945
"name.class": supported,
5046
"name.field": supported,
5147
"name.argument.formal": supported,
5248
"name.argument.formal.iteration": supported,
53-
"name.iteration.block": supported,
54-
"name.iteration.document": supported,
5549
"value.assignment": supported,
5650
"value.variable": supported,
57-
"value.attribute": supported,
58-
"value.foreach": supported,
5951
"value.return": supported,
6052
"value.return.lambda": supported,
6153
"value.field": supported,
62-
"value.argument.actual": supported,
63-
"value.argument.actual.iteration": supported,
6454

65-
"value.typeAlias": supported,
6655
"type.variable": supported,
6756
"type.argument.formal": supported,
68-
"type.argument.formal.iteration": supported,
69-
"type.argument.formal.method": supported,
70-
"type.argument.formal.method.iteration": supported,
71-
"type.argument.formal.constructor": supported,
72-
"type.argument.formal.constructor.iteration": supported,
73-
"type.return": supported,
7457
"type.field": supported,
7558
"type.field.iteration": supported,
7659
"type.foreach": supported,
7760
"type.enum": supported,
78-
"type.alias": supported,
7961
"type.cast": supported,
8062
"type.class": supported,
81-
"type.typeArgument": supported,
82-
"type.typeArgument.iteration": supported,
63+
"type.return": supported,
8364

8465
// Unsupported
8566

8667
switchStatementSubject: unsupported,
68+
fieldAccess: unsupported,
8769

8870
"statement.class": unsupported,
8971
"statement.iteration.document": unsupported,
@@ -104,10 +86,6 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = {
10486
"interior.ternary": unsupported,
10587
"interior.loop": unsupported,
10688

107-
// Unsupported
108-
109-
fieldAccess: unsupported,
110-
11189
"branch.if": unsupported,
11290
"branch.if.iteration": unsupported,
11391
"branch.try": unsupported,
@@ -125,6 +103,11 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = {
125103
"condition.switchCase": unsupported,
126104
"condition.switchCase.iteration": unsupported,
127105

106+
"name.iteration.block": unsupported,
107+
"name.iteration.document": unsupported,
108+
109+
"type.argument.formal.iteration": unsupported,
110+
128111
// Not applicable (C and C++)
129112

130113
map: notApplicable,
@@ -164,7 +147,12 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = {
164147
"value.mapPair": notApplicable,
165148
"value.mapPair.iteration": notApplicable,
166149
"value.yield": notApplicable,
150+
"value.attribute": notApplicable,
151+
"value.argument.actual": notApplicable,
152+
"value.argument.actual.iteration": notApplicable,
167153
"type.interface": notApplicable,
154+
"value.typeAlias": notApplicable,
155+
"type.alias": notApplicable,
168156
};
169157

170158
export const cScopeSupport: LanguageScopeSupportFacetMap = {
@@ -208,21 +196,34 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = {
208196
"value.argument.formal.method.iteration": notApplicable,
209197
"value.argument.formal.constructor": notApplicable,
210198
"value.argument.formal.constructor.iteration": notApplicable,
199+
"value.foreach": notApplicable,
200+
211201
"name.argument.formal.method": notApplicable,
212202
"name.argument.formal.method.iteration": notApplicable,
213203
"name.argument.formal.constructor": notApplicable,
214204
"name.argument.formal.constructor.iteration": notApplicable,
215-
216-
"functionName.iteration.block": notApplicable,
217-
"functionName.constructor": notApplicable,
205+
"name.method": notApplicable,
206+
"name.constructor": notApplicable,
207+
"name.foreach": notApplicable,
218208

219209
"namedFunction.iteration.block": notApplicable,
220210
"namedFunction.iteration.document": notApplicable,
221211
"namedFunction.method": notApplicable,
222212
"namedFunction.method.iteration.class": notApplicable,
223213
"namedFunction.constructor": notApplicable,
224214

215+
"functionName.iteration.block": notApplicable,
216+
"functionName.constructor": notApplicable,
217+
"functionName.method": notApplicable,
225218
"functionName.method.iteration.class": notApplicable,
219+
226220
"functionCall.constructor": notApplicable,
227221
"functionCallee.constructor": notApplicable,
222+
223+
"type.argument.formal.method": notApplicable,
224+
"type.argument.formal.method.iteration": notApplicable,
225+
"type.argument.formal.constructor": notApplicable,
226+
"type.argument.formal.constructor.iteration": notApplicable,
227+
"type.typeArgument": notApplicable,
228+
"type.typeArgument.iteration": notApplicable,
228229
};

packages/common/src/scopeSupportFacets/cpp.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = {
3434

3535
"functionName.iteration.block": supported,
3636
"functionName.constructor": supported,
37+
"functionName.method": supported,
3738

3839
"namedFunction.iteration.block": supported,
3940
"namedFunction.iteration.document": supported,
@@ -57,8 +58,19 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = {
5758
"name.argument.formal.constructor": supported,
5859
"name.argument.formal.constructor.iteration": supported,
5960

61+
"type.argument.formal.method": supported,
62+
"type.argument.formal.method.iteration": supported,
63+
"type.argument.formal.constructor": supported,
64+
"type.argument.formal.constructor.iteration": supported,
65+
"type.typeArgument": supported,
66+
6067
// Unsupported
6168

6269
"namedFunction.method.iteration.class": unsupported,
6370
"interior.lambda": unsupported,
71+
"name.method": unsupported,
72+
"name.constructor": unsupported,
73+
"name.foreach": unsupported,
74+
"value.foreach": unsupported,
75+
"type.typeArgument.iteration": unsupported,
6476
};

packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ export const scopeSupportFacetInfos: Record<
710710
isIteration: true,
711711
},
712712
"value.argument.actual": {
713-
description: "The value of a argument in a function call",
713+
description: "The value of a keyword argument in a function call",
714714
scopeType: "value",
715715
},
716716
"value.argument.actual.iteration": {

queries/c.scm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,17 @@
195195
(_
196196
type: (_) @type
197197
) @_.domain
198-
(#not-type? @_.domain "type_definition")
198+
(#not-type? @_.domain type_definition type_descriptor cast_expression)
199199
)
200200

201+
;;!! (int)5.5;
202+
;;! ^^^
203+
(cast_expression
204+
"(" @type.removal.start
205+
type: (_) @type
206+
")" @type.removal.end
207+
) @_.domain
208+
201209
;;!! void foo(int value) {}
202210
;;! ^^^^^
203211
(parameter_declaration

0 commit comments

Comments
 (0)