Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit e4c2db3

Browse files
authored
Merge pull request #79 from abeaumont/fix/call-callee-role
annotations: Fix annotation for CallCallee and related tests
2 parents 5eca4f8 + d558fdb commit e4c2db3

17 files changed

+33
-32
lines changed

ANNOTATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='args'\] | CallPositionalArgument |
7777
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\] | CallNamedArgument |
7878
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\]/\*\[@internalRole\]\[@internalRole='value'\] | CallNamedArgumentValue |
79-
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Name'\] | Call |
79+
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Name'\] | CallCallee |
8080
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\] | CallCallee |
8181
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\]/\*\[@internalRole\]\[@internalRole='value'\] | CallReceiver |
8282
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\] | Assignment, Expression |

driver/normalizer/annotation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ var AnnotationRules = On(Any).Self(
170170
On(HasInternalRole("value")).Roles(CallNamedArgumentValue),
171171
),
172172
On(HasInternalRole("func")).Self(
173-
On(HasInternalType(pyast.Name)).Roles(Call),
173+
On(HasInternalType(pyast.Name)).Roles(CallCallee),
174174
On(HasInternalType(pyast.Attribute)).Roles(CallCallee).Children(
175175
On(HasInternalRole("value")).Roles(CallReceiver),
176176
)),
@@ -267,7 +267,8 @@ var AnnotationRules = On(Any).Self(
267267
On(HasInternalType("ClassDef.bases")).Roles(TypeDeclarationBases),
268268
On(HasInternalType("ClassDef.keywords")).Roles(Incomplete).Children(
269269
On(HasInternalType(pyast.Keyword)).Roles(SimpleIdentifier, Incomplete),
270-
)),
270+
),
271+
),
271272

272273
On(HasInternalType(pyast.For)).Roles(ForEach, Statement).Children(
273274
On(HasInternalType("For.body")).Roles(ForBody),

tests/classdef.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ Module {
807807
. . . . . }
808808
. . . . . Children: {
809809
. . . . . . 0: Name {
810-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
810+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
811811
. . . . . . . TOKEN "Animal"
812812
. . . . . . . StartPosition: {
813813
. . . . . . . . Offset: 225

tests/except.py.uast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Module {
137137
. . . . . . . . . . . }
138138
. . . . . . . . . . }
139139
. . . . . . . . . . 1: Name {
140-
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
140+
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
141141
. . . . . . . . . . . TOKEN "Exception"
142142
. . . . . . . . . . . StartPosition: {
143143
. . . . . . . . . . . . Offset: 25
@@ -213,7 +213,7 @@ Module {
213213
. . . . . . . . . . . }
214214
. . . . . . . . . . }
215215
. . . . . . . . . . 1: Name {
216-
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
216+
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
217217
. . . . . . . . . . . TOKEN "print"
218218
. . . . . . . . . . . StartPosition: {
219219
. . . . . . . . . . . . Offset: 147
@@ -306,7 +306,7 @@ Module {
306306
. . . . . . . . . . . . . }
307307
. . . . . . . . . . . . }
308308
. . . . . . . . . . . . 1: Name {
309-
. . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
309+
. . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
310310
. . . . . . . . . . . . . TOKEN "print"
311311
. . . . . . . . . . . . . StartPosition: {
312312
. . . . . . . . . . . . . . Offset: 76
@@ -414,7 +414,7 @@ Module {
414414
. . . . . . . . . . . . . }
415415
. . . . . . . . . . . . }
416416
. . . . . . . . . . . . 1: Name {
417-
. . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
417+
. . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
418418
. . . . . . . . . . . . . TOKEN "print"
419419
. . . . . . . . . . . . . StartPosition: {
420420
. . . . . . . . . . . . . . Offset: 119

tests/exec.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Module {
6464
. . . . . . . }
6565
. . . . . . }
6666
. . . . . . 1: Name {
67-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
67+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
6868
. . . . . . . TOKEN "exec"
6969
. . . . . . . StartPosition: {
7070
. . . . . . . . Offset: 0

tests/for.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Module {
148148
. . . . . . . . . . . }
149149
. . . . . . . . . . }
150150
. . . . . . . . . . 1: Name {
151-
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
151+
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
152152
. . . . . . . . . . . TOKEN "print"
153153
. . . . . . . . . . . StartPosition: {
154154
. . . . . . . . . . . . Offset: 33

tests/functioncalls.py.uast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Module {
100100
. . . . . . . }
101101
. . . . . . }
102102
. . . . . . 3: Name {
103-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
103+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
104104
. . . . . . . TOKEN "normalCall"
105105
. . . . . . . StartPosition: {
106106
. . . . . . . . Offset: 0
@@ -299,7 +299,7 @@ Module {
299299
. . . . . . . }
300300
. . . . . . }
301301
. . . . . . 1: Name {
302-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
302+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
303303
. . . . . . . TOKEN "keyCall"
304304
. . . . . . . StartPosition: {
305305
. . . . . . . . Offset: 87
@@ -482,7 +482,7 @@ Module {
482482
. . . . . . . }
483483
. . . . . . }
484484
. . . . . . 2: Name {
485-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
485+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
486486
. . . . . . . TOKEN "expandListCall"
487487
. . . . . . . StartPosition: {
488488
. . . . . . . . Offset: 108
@@ -554,7 +554,7 @@ Module {
554554
. . . . . . . }
555555
. . . . . . }
556556
. . . . . . 1: Name {
557-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
557+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
558558
. . . . . . . TOKEN "expandMapCall"
559559
. . . . . . . StartPosition: {
560560
. . . . . . . . Offset: 141

tests/functiondef_decorated.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ Module {
253253
. . . . . . . . . }
254254
. . . . . . . . }
255255
. . . . . . . . 3: Name {
256-
. . . . . . . . . Roles: Call,SimpleIdentifier,Expression
256+
. . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
257257
. . . . . . . . . TOKEN "somedecoratorparams"
258258
. . . . . . . . . StartPosition: {
259259
. . . . . . . . . . Offset: 44

tests/hello.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Module {
6464
. . . . . . . }
6565
. . . . . . }
6666
. . . . . . 1: Name {
67-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
67+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
6868
. . . . . . . TOKEN "print"
6969
. . . . . . . StartPosition: {
7070
. . . . . . . . Offset: 0

tests/if.py.uast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Module {
8383
. . . . . . . . . . . }
8484
. . . . . . . . . . }
8585
. . . . . . . . . . 1: Name {
86-
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
86+
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
8787
. . . . . . . . . . . TOKEN "print"
8888
. . . . . . . . . . . StartPosition: {
8989
. . . . . . . . . . . . Offset: 13
@@ -194,7 +194,7 @@ Module {
194194
. . . . . . . . . . . }
195195
. . . . . . . . . . }
196196
. . . . . . . . . . 1: Name {
197-
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
197+
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
198198
. . . . . . . . . . . TOKEN "print"
199199
. . . . . . . . . . . StartPosition: {
200200
. . . . . . . . . . . . Offset: 49
@@ -234,7 +234,7 @@ Module {
234234
. . . . . }
235235
. . . . . Children: {
236236
. . . . . . 0: Name {
237-
. . . . . . . Roles: Call,SimpleIdentifier,Expression
237+
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
238238
. . . . . . . TOKEN "functionCall"
239239
. . . . . . . StartPosition: {
240240
. . . . . . . . Offset: 29

0 commit comments

Comments
 (0)