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

Commit d0b4475

Browse files
authored
Merge pull request #66 from juanjux/fix/spurious_simple_identifier
Removed unneeded SimpleIdentifier, mark ellipsis as Incomplete
2 parents a4861a6 + 80865c8 commit d0b4475

File tree

6 files changed

+12
-196
lines changed

6 files changed

+12
-196
lines changed

ANNOTATION.md

Lines changed: 0 additions & 183 deletions
Large diffs are not rendered by default.

driver/normalizer/annotation.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ var AnnotationRules = On(Any).Self(
112112
SimpleIdentifier),
113113
On(HasInternalType(pyast.AsyncFunctionDef)).Roles(FunctionDeclaration,
114114
FunctionDeclarationName, SimpleIdentifier, Incomplete),
115-
On(HasInternalType("FunctionDef.decorator_list")).Roles(Call, SimpleIdentifier, Incomplete),
115+
On(HasInternalType("FunctionDef.decorator_list")).Roles(Call, Incomplete),
116116
On(HasInternalType("FunctionDef.body")).Roles(FunctionDeclarationBody),
117117
// FIXME: change to FunctionDeclarationArgumentS once the PR has been merged
118118
On(HasInternalType(pyast.Arguments)).Roles(FunctionDeclarationArgument, Incomplete).Children(
@@ -132,12 +132,11 @@ var AnnotationRules = On(Any).Self(
132132
// TODO: create an issue for the SDK
133133
On(HasInternalType("arguments.defaults")).Roles(FunctionDeclarationArgumentDefaultValue, Incomplete),
134134
On(HasInternalType("arguments.keywords")).Roles(FunctionDeclarationArgumentDefaultValue, Incomplete),
135-
On(HasInternalType("AsyncFunctionDef.decorator_list")).Roles(Call, SimpleIdentifier, Incomplete),
135+
On(HasInternalType("AsyncFunctionDef.decorator_list")).Roles(Call, Incomplete),
136136
On(HasInternalType("AsyncFunctionDef.body")).Roles(FunctionDeclarationBody),
137137
// FIXME: change to FunctionDeclarationArgumentS once the PR has been merged
138138
),
139-
On(HasInternalType(pyast.Lambda)).Roles(FunctionDeclaration, SimpleIdentifier, Expression,
140-
Incomplete).Children(
139+
On(HasInternalType(pyast.Lambda)).Roles(FunctionDeclaration, Expression, Incomplete).Children(
141140
On(HasInternalType("Lambda.body")).Roles(FunctionDeclarationBody),
142141
// FIXME: change to FunctionDeclarationArgumentS once the PR has been merged
143142
On(HasInternalType(pyast.Arguments)).Roles(FunctionDeclarationArgument, Incomplete).Children(
@@ -156,9 +155,9 @@ var AnnotationRules = On(Any).Self(
156155
// defaults [2,3]
157156
// TODO: create an issue for the SDK
158157
On(HasInternalType("arguments.defaults")).Roles(FunctionDeclarationArgumentDefaultValue,
159-
SimpleIdentifier, Incomplete),
158+
Incomplete),
160159
On(HasInternalType("arguments.keywords")).Roles(FunctionDeclarationArgumentDefaultValue,
161-
SimpleIdentifier, Incomplete),
160+
Incomplete),
162161
),
163162
),
164163

@@ -317,7 +316,7 @@ var AnnotationRules = On(Any).Self(
317316

318317
// Python very odd ellipsis operator. Has a special rule in tonoder synthetic tokens
319318
// map to load it with the token "PythonEllipsisOperator" and gets the role SimpleIdentifier
320-
On(HasInternalType(pyast.Ellipsis)).Roles(SimpleIdentifier),
319+
On(HasInternalType(pyast.Ellipsis)).Roles(SimpleIdentifier, Incomplete),
321320

322321
// List/Map/Set comprehensions. We map the "for x in y" to ForEach roles and the
323322
// "if something" to If* roles. FIXME: missing the top comprehension roles in the UAST, change

tests/classdef.py.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ Module {
473473
. . . . . . . . . }
474474
. . . . . . . . }
475475
. . . . . . . . 2: FunctionDef.decorator_list {
476-
. . . . . . . . . Roles: Call,SimpleIdentifier,Incomplete
476+
. . . . . . . . . Roles: Call,Incomplete
477477
. . . . . . . . . Properties: {
478478
. . . . . . . . . . promotedPropertyList: true
479479
. . . . . . . . . }
@@ -667,7 +667,7 @@ Module {
667667
. . . . . . . . . }
668668
. . . . . . . . }
669669
. . . . . . . . 2: FunctionDef.decorator_list {
670-
. . . . . . . . . Roles: Call,SimpleIdentifier,Incomplete
670+
. . . . . . . . . Roles: Call,Incomplete
671671
. . . . . . . . . Properties: {
672672
. . . . . . . . . . promotedPropertyList: true
673673
. . . . . . . . . }

tests/ellipsis.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Module {
4848
. . . . . }
4949
. . . . . Children: {
5050
. . . . . . 0: Ellipsis {
51-
. . . . . . . Roles: SimpleIdentifier
51+
. . . . . . . Roles: SimpleIdentifier,Incomplete
5252
. . . . . . . TOKEN "PythonEllipsisOperator"
5353
. . . . . . . StartPosition: {
5454
. . . . . . . . Offset: 1

tests/functiondef_decorated.py.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Module {
6565
. . . . . }
6666
. . . . }
6767
. . . . 2: FunctionDef.decorator_list {
68-
. . . . . Roles: Call,SimpleIdentifier,Incomplete
68+
. . . . . Roles: Call,Incomplete
6969
. . . . . Properties: {
7070
. . . . . . promotedPropertyList: true
7171
. . . . . }
@@ -180,7 +180,7 @@ Module {
180180
. . . . . }
181181
. . . . }
182182
. . . . 2: FunctionDef.decorator_list {
183-
. . . . . Roles: Call,SimpleIdentifier,Incomplete
183+
. . . . . Roles: Call,Incomplete
184184
. . . . . Properties: {
185185
. . . . . . promotedPropertyList: true
186186
. . . . . }

tests/lambda.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Module {
3131
. . . }
3232
. . . Children: {
3333
. . . . 0: Lambda {
34-
. . . . . Roles: FunctionDeclaration,SimpleIdentifier,Expression,Incomplete
34+
. . . . . Roles: FunctionDeclaration,Expression,Incomplete
3535
. . . . . StartPosition: {
3636
. . . . . . Offset: 0
3737
. . . . . . Line: 1

0 commit comments

Comments
 (0)