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

Commit 27fee73

Browse files
author
Juanjo Alvarez
committed
Remove Identifier from the arguments grouping node. Remove dups
1 parent f122947 commit 27fee73

30 files changed

+2569
-28
lines changed

ANNOTATION.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,14 @@
235235
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Dict'\]/\*\[@internalRole\]\[@internalRole='values'\] | Map, Value |
236236
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Tuple'\] | Literal, Tuple, Expression |
237237
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\] | Function, Declaration, Name, Identifier |
238-
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\]/\*\[@InternalType='arguments'\] | Function, Declaration, Incomplete |
239-
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='args'\] | Function, Declaration |
238+
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\]/\*\[@InternalType='arguments'\] | Function, Declaration, Incomplete, Argument |
239+
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='args'\] | Function, Declaration, Argument, Name, Identifier |
240240
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='vararg'\] | Function, Declaration, Argument, ArgsList, Name, Identifier |
241241
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='kwarg'\] | Function, Declaration, Argument, ArgsList, Map, Name, Identifier |
242242
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='kwonlyargs'\] | Function, Declaration, Argument, ArgsList, Map, Name, Identifier |
243243
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef'\] | Function, Declaration, Name, Identifier, Incomplete |
244244
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.decorator\_list'\] | Function, Declaration, Call, Incomplete |
245245
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.body'\] | Function, Declaration, Body |
246-
| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='args'\] | Argument, Name, Identifier |
247246
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments\.defaults'\] | Function, Declaration, Argument, Value, Incomplete |
248247
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef\.decorator\_list'\] | Function, Declaration, Call, Incomplete |
249248
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef\.body'\] | Function, Declaration, Body |
@@ -252,7 +251,7 @@
252251
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Attribute'\] | Identifier, Expression |
253252
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Attribute'\]/\*\[@InternalType='Name'\] | Identifier, Qualified |
254253
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\] | Function, Call, Expression |
255-
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='args'\] | Function, Call, Positional |
254+
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='args'\] | Function, Call, Positional, Argument, Name |
256255
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\] | Function, Call, Argument, Name |
257256
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\]/\*\[@internalRole\]\[@internalRole='value'\] | Argument, Value |
258257
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Name'\] | Call, Callee |

driver/normalizer/annotation.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ var AnnotationRules = On(Any).Self(
128128
// FIXME: the FunctionDeclarationReceiver is not set for methods; it should be taken from the parent
129129
// Type node Token (2 levels up) but the SDK doesn't allow this
130130
On(pyast.FunctionDef).Roles(uast.Function, uast.Declaration, uast.Name, uast.Identifier).Children(
131-
// Other roles are set on the generic HasInternalRole("args") below
132-
On(pyast.Arguments).Roles(uast.Function, uast.Declaration, uast.Incomplete).Children(
133-
On(HasInternalRole("args")).Roles(uast.Function, uast.Declaration),
131+
On(pyast.Arguments).Roles(uast.Function, uast.Declaration, uast.Incomplete, uast.Argument).Children(
132+
On(HasInternalRole("args")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.Name, uast.Identifier),
134133
On(HasInternalRole("vararg")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.ArgsList, uast.Name, uast.Identifier),
135134
On(HasInternalRole("kwarg")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier),
136135
On(HasInternalRole("kwonlyargs")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier),
@@ -139,7 +138,6 @@ var AnnotationRules = On(Any).Self(
139138
On(pyast.AsyncFunctionDef).Roles(uast.Function, uast.Declaration, uast.Name, uast.Identifier, uast.Incomplete),
140139
On(pyast.FuncDecorators).Roles(uast.Function, uast.Declaration, uast.Call, uast.Incomplete),
141140
On(pyast.FuncDefBody).Roles(uast.Function, uast.Declaration, uast.Body),
142-
On(HasInternalRole("args")).Roles(uast.Argument, uast.Name, uast.Identifier),
143141
// Default arguments: Python's AST puts default arguments on a sibling list to the one of
144142
// arguments that must be mapped to the arguments right-aligned like:
145143
// a, b=2, c=3 ->
@@ -158,7 +156,7 @@ var AnnotationRules = On(Any).Self(
158156
On(pyast.Name).Roles(uast.Identifier, uast.Qualified)),
159157

160158
On(pyast.Call).Roles(uast.Function, uast.Call, uast.Expression).Children(
161-
On(HasInternalRole("args")).Roles(uast.Function, uast.Call, uast.Positional),
159+
On(HasInternalRole("args")).Roles(uast.Function, uast.Call, uast.Positional, uast.Argument, uast.Name),
162160
On(HasInternalRole("keywords")).Roles(uast.Function, uast.Call, uast.Argument, uast.Name).Children(
163161
On(HasInternalRole("value")).Roles(uast.Argument, uast.Value),
164162
),

fixtures/annotations.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Module {
140140
. . . }
141141
. . . Children: {
142142
. . . . 0: arguments {
143-
. . . . . Roles: Function,Declaration,Incomplete,Argument,Name,Identifier
143+
. . . . . Roles: Function,Declaration,Incomplete,Argument
144144
. . . . . Properties: {
145145
. . . . . . internalRole: args
146146
. . . . . . kwarg: <nil>

fixtures/classdef.py.uast

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ Module {
4545
. . . . . . . }
4646
. . . . . . . Children: {
4747
. . . . . . . . 0: arguments {
48+
<<<<<<< HEAD
4849
. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier
50+
||||||| merged common ancestors
51+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument,Name,Identifier
52+
=======
53+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument
54+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
4955
. . . . . . . . . Properties: {
5056
. . . . . . . . . . internalRole: args
5157
. . . . . . . . . . kwarg: <nil>
@@ -210,7 +216,13 @@ Module {
210216
. . . . . . . }
211217
. . . . . . . Children: {
212218
. . . . . . . . 0: arguments {
219+
<<<<<<< HEAD
213220
. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier
221+
||||||| merged common ancestors
222+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument,Name,Identifier
223+
=======
224+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument
225+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
214226
. . . . . . . . . Properties: {
215227
. . . . . . . . . . internalRole: args
216228
. . . . . . . . . . kwarg: <nil>
@@ -445,7 +457,13 @@ Module {
445457
. . . . . . . . . }
446458
. . . . . . . . }
447459
. . . . . . . . 2: arguments {
460+
<<<<<<< HEAD
448461
. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier
462+
||||||| merged common ancestors
463+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument,Name,Identifier
464+
=======
465+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument
466+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
449467
. . . . . . . . . Properties: {
450468
. . . . . . . . . . internalRole: args
451469
. . . . . . . . . . kwarg: <nil>
@@ -467,7 +485,13 @@ Module {
467485
. . . . . . . }
468486
. . . . . . . Children: {
469487
. . . . . . . . 0: arguments {
488+
<<<<<<< HEAD
470489
. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier
490+
||||||| merged common ancestors
491+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument,Name,Identifier
492+
=======
493+
. . . . . . . . . Roles: Function,Declaration,Incomplete,Argument
494+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
471495
. . . . . . . . . Properties: {
472496
. . . . . . . . . . internalRole: args
473497
. . . . . . . . . . kwarg: <nil>
@@ -1006,7 +1030,13 @@ Module {
10061030
. . . . . }
10071031
. . . . . Children: {
10081032
. . . . . . 0: Num {
1033+
<<<<<<< HEAD
10091034
. . . . . . . Roles: Literal,Number,Expression,Primitive,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional
1035+
||||||| merged common ancestors
1036+
. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Function,Call,Positional
1037+
=======
1038+
. . . . . . . Roles: Literal,Number,Expression,Function,Call,Positional,Argument,Name
1039+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
10101040
. . . . . . . TOKEN "5"
10111041
. . . . . . . StartPosition: {
10121042
. . . . . . . . Offset: 269

fixtures/except.py.uast

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ Module {
100100
. . . . . . . . . }
101101
. . . . . . . . . Children: {
102102
. . . . . . . . . . 0: Str {
103+
<<<<<<< HEAD
103104
. . . . . . . . . . . Roles: Literal,String,Expression,Primitive,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional
105+
||||||| merged common ancestors
106+
. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Function,Call,Positional
107+
=======
108+
. . . . . . . . . . . Roles: Literal,String,Expression,Function,Call,Positional,Argument,Name
109+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
104110
. . . . . . . . . . . TOKEN "gogogo"
105111
. . . . . . . . . . . StartPosition: {
106112
. . . . . . . . . . . . Offset: 35
@@ -166,7 +172,13 @@ Module {
166172
. . . . . . . . . }
167173
. . . . . . . . . Children: {
168174
. . . . . . . . . . 0: Str {
175+
<<<<<<< HEAD
169176
. . . . . . . . . . . Roles: Literal,String,Expression,Primitive,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional
177+
||||||| merged common ancestors
178+
. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Function,Call,Positional
179+
=======
180+
. . . . . . . . . . . Roles: Literal,String,Expression,Function,Call,Positional,Argument,Name
181+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
170182
. . . . . . . . . . . TOKEN "here we are"
171183
. . . . . . . . . . . StartPosition: {
172184
. . . . . . . . . . . . Offset: 153
@@ -246,7 +258,13 @@ Module {
246258
. . . . . . . . . }
247259
. . . . . . . . . Children: {
248260
. . . . . . . . . . 0: Str {
261+
<<<<<<< HEAD
249262
. . . . . . . . . . . Roles: Literal,String,Expression,Primitive,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional
263+
||||||| merged common ancestors
264+
. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Function,Call,Positional
265+
=======
266+
. . . . . . . . . . . Roles: Literal,String,Expression,Function,Call,Positional,Argument,Name
267+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
250268
. . . . . . . . . . . TOKEN "someexception catched"
251269
. . . . . . . . . . . StartPosition: {
252270
. . . . . . . . . . . . Offset: 82
@@ -347,7 +365,13 @@ Module {
347365
. . . . . . . . . }
348366
. . . . . . . . . Children: {
349367
. . . . . . . . . . 0: Str {
368+
<<<<<<< HEAD
350369
. . . . . . . . . . . Roles: Literal,String,Expression,Primitive,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional
370+
||||||| merged common ancestors
371+
. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Function,Call,Positional
372+
=======
373+
. . . . . . . . . . . Roles: Literal,String,Expression,Function,Call,Positional,Argument,Name
374+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
351375
. . . . . . . . . . . TOKEN "ayyyy"
352376
. . . . . . . . . . . StartPosition: {
353377
. . . . . . . . . . . . Offset: 125

fixtures/exec.py.uast

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ Module {
2727
. . . . . }
2828
. . . . . Children: {
2929
. . . . . . 0: Str {
30+
<<<<<<< HEAD
3031
. . . . . . . Roles: Literal,String,Expression,Primitive,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional
32+
||||||| merged common ancestors
33+
. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Function,Call,Positional
34+
=======
35+
. . . . . . . Roles: Literal,String,Expression,Function,Call,Positional,Argument,Name
36+
>>>>>>> Remove Identifier from the arguments grouping node. Remove dups
3137
. . . . . . . TOKEN "print 1"
3238
. . . . . . . StartPosition: {
3339
. . . . . . . . Offset: 5

fixtures/for.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Module {
105105
. . . . . . . . . }
106106
. . . . . . . . . Children: {
107107
. . . . . . . . . . 0: Name {
108-
. . . . . . . . . . . Roles: Argument,Name,Identifier,Function,Call,Positional,Identifier,Expression
108+
. . . . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Identifier,Expression
109109
. . . . . . . . . . . TOKEN "i"
110110
. . . . . . . . . . . StartPosition: {
111111
. . . . . . . . . . . . Offset: 39

0 commit comments

Comments
 (0)