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

Commit fb104a8

Browse files
authored
Merge pull request #120 from juanjux/fix/1stlevelNoneNodes
Fix None directly visited by the main visit method
2 parents 08a58f2 + c46ce1e commit fb104a8

File tree

10 files changed

+4741
-15
lines changed

10 files changed

+4741
-15
lines changed

fixtures/issue119.py.native

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"status": "ok",
3+
"errors": [],
4+
"ast": {
5+
"PY3AST": {
6+
"ast_type": "Module",
7+
"body": [
8+
{
9+
"args": {
10+
"args": [],
11+
"ast_type": "arguments",
12+
"defaults": [],
13+
"kw_defaults": [],
14+
"kwarg": null,
15+
"kwonlyargs": [],
16+
"vararg": null
17+
},
18+
"ast_type": "FunctionDef",
19+
"body": [
20+
{
21+
"ast_type": "Assign",
22+
"col_offset": 5,
23+
"lineno": 2,
24+
"targets": [
25+
{
26+
"ast_type": "Name",
27+
"col_offset": 5,
28+
"ctx": "Store",
29+
"end_col_offset": 5,
30+
"end_lineno": 2,
31+
"id": "a",
32+
"lineno": 2
33+
}
34+
],
35+
"value": {
36+
"ast_type": "Dict",
37+
"col_offset": 9,
38+
"keys": [
39+
{
40+
"ast_type": "Str",
41+
"col_offset": 10,
42+
"end_col_offset": 12,
43+
"end_lineno": 2,
44+
"lineno": 2,
45+
"s": "1"
46+
}
47+
],
48+
"lineno": 2,
49+
"values": [
50+
{
51+
"ast_type": "Num",
52+
"col_offset": 15,
53+
"end_col_offset": 15,
54+
"end_lineno": 2,
55+
"lineno": 2,
56+
"n": 1
57+
}
58+
]
59+
}
60+
},
61+
{
62+
"ast_type": "Assign",
63+
"col_offset": 5,
64+
"lineno": 3,
65+
"targets": [
66+
{
67+
"ast_type": "Name",
68+
"col_offset": 5,
69+
"ctx": "Store",
70+
"end_col_offset": 5,
71+
"end_lineno": 3,
72+
"id": "b",
73+
"lineno": 3
74+
}
75+
],
76+
"value": {
77+
"ast_type": "Dict",
78+
"col_offset": 9,
79+
"keys": [
80+
{
81+
"ast_type": "Str",
82+
"col_offset": 10,
83+
"end_col_offset": 12,
84+
"end_lineno": 3,
85+
"lineno": 3,
86+
"s": "2"
87+
}
88+
],
89+
"lineno": 3,
90+
"values": [
91+
{
92+
"ast_type": "Num",
93+
"col_offset": 15,
94+
"end_col_offset": 15,
95+
"end_lineno": 3,
96+
"lineno": 3,
97+
"n": 2
98+
}
99+
]
100+
}
101+
},
102+
{
103+
"ast_type": "Return",
104+
"col_offset": 5,
105+
"end_col_offset": 10,
106+
"end_lineno": 4,
107+
"lineno": 4,
108+
"value": {
109+
"ast_type": "Dict",
110+
"col_offset": 12,
111+
"keys": [
112+
{
113+
"LiteralValue": "None",
114+
"ast_type": "NoneLiteral"
115+
},
116+
{
117+
"LiteralValue": "None",
118+
"ast_type": "NoneLiteral"
119+
}
120+
],
121+
"lineno": 4,
122+
"values": [
123+
{
124+
"ast_type": "Name",
125+
"col_offset": 15,
126+
"ctx": "Load",
127+
"end_col_offset": 15,
128+
"end_lineno": 4,
129+
"id": "a",
130+
"lineno": 4
131+
},
132+
{
133+
"ast_type": "Name",
134+
"col_offset": 20,
135+
"ctx": "Load",
136+
"end_col_offset": 20,
137+
"end_lineno": 4,
138+
"id": "b",
139+
"lineno": 4
140+
}
141+
]
142+
}
143+
}
144+
],
145+
"col_offset": 5,
146+
"decorator_list": [],
147+
"end_col_offset": 7,
148+
"end_lineno": 1,
149+
"lineno": 1,
150+
"name": "foo",
151+
"returns": null
152+
}
153+
]
154+
}
155+
}
156+
}

fixtures/issue119.py.source

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def foo():
2+
a = {'1': 1}
3+
b = {'2': 2}
4+
return {**a, **b}

0 commit comments

Comments
 (0)