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

Commit 0187db8

Browse files
authored
Merge pull request #136 from juanjux/fix/change_qualified
Fix/change qualified
2 parents 0bc8694 + 8b15e01 commit 0187db8

File tree

208 files changed

+497
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+497
-352
lines changed

driver/normalizer/annotation.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ var AnnotationRules = On(Any).Self(
156156
argumentsAnn,
157157
),
158158

159-
On(pyast.Attribute).Roles(uast.Identifier, uast.Expression).Children(
160-
On(pyast.Name).Roles(uast.Qualified)),
161-
162159
On(pyast.Call).Roles(uast.Function, uast.Call, uast.Expression).Children(
163160
On(HasInternalRole("args")).Roles(uast.Function, uast.Call, uast.Positional, uast.Argument, uast.Name),
164161
On(HasInternalRole("keywords")).Roles(uast.Function, uast.Call, uast.Argument, uast.Name).Children(
@@ -187,6 +184,16 @@ var AnnotationRules = On(Any).Self(
187184
On(HasInternalRole("value")).Roles(uast.Right),
188185
),
189186

187+
// a.b.c ("a" and "b" will be Qualified, "c" will be just Identifier). Python does the
188+
// reverse thing
189+
On(pyast.Attribute).Self(
190+
On(HasProperty("ctx", "Load")).Roles(uast.Qualified, uast.Identifier, uast.Expression),
191+
On(HasProperty("ctx", "Store")).Roles(uast.Identifier, uast.Expression),
192+
On(HasChild(pyast.Name)).Children(
193+
On(Any).Roles(uast.Qualified), // Identifier and Expr added on all Name(s) below
194+
),
195+
),
196+
190197
On(pyast.Expression).Roles(uast.Expression),
191198
On(pyast.Expr).Roles(uast.Expression),
192199
On(pyast.Name).Roles(uast.Identifier, uast.Expression),
File renamed without changes.

fixtures/annotations.py.native

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"status": "ok",
3+
"language": "",
34
"errors": [],
45
"ast": {
56
"PY3AST": {

fixtures/annotations.py.uast

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Status: ok
2+
Language:
23
Errors:
34
UAST:
45
Module {
File renamed without changes.

fixtures/aritmeticops.py.native

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"status": "ok",
3+
"language": "",
34
"errors": [],
45
"ast": {
56
"PY3AST": {

fixtures/aritmeticops.py.uast

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Status: ok
2+
Language:
23
Errors:
34
UAST:
45
Module {
File renamed without changes.

fixtures/assert_constant.py.native

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"status": "ok",
3+
"language": "",
34
"errors": [],
45
"ast": {
56
"PY3AST": {

fixtures/assert_constant.py.uast

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Status: ok
2+
Language:
23
Errors:
34
UAST:
45
Module {

0 commit comments

Comments
 (0)