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

Commit 6fcd35d

Browse files
author
Juanjo Alvarez
committed
Fixes
- Fixes from review. - Add comments to the FunctionGroup. - Add comments to boxes attributes. Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent cf6afae commit 6fcd35d

Some content is hidden

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

50 files changed

+218
-415
lines changed

driver/fixtures/fixtures_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var Suite = &fixtures.Suite{
2727
Semantic: fixtures.SemanticConfig{
2828
BlacklistTypes: []string{
2929
"AsyncFunctionDef",
30+
"Attribute",
3031
"BoolLiteral",
3132
"Bytes",
3233
"FunctionDef",

driver/normalizer/normalizer.go

+18-17
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,19 @@ func funcDefMap(typ string, async bool) Mapping {
4949
}),
5050
},
5151
{Name: "decorator_list", Op: Var("func_decorators")},
52+
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
53+
{Name: "noops_sameline", Optional: "ns_opt", Op: Var("noops_sameline")},
5254
},
5355
Obj{
5456
"Nodes": Arr(
55-
Obj{
57+
Fields{
5658
// FIXME: generator=true if it uses yield anywhere in the body
57-
"async": Bool(async),
58-
"decorators": Var("func_decorators"),
59+
{Name: "async", Op: Bool(async)},
60+
{Name: "decorators", Op: Var("func_decorators")},
61+
{Name: "comments", Op: Fields{
62+
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
63+
{Name: "noops_sameline", Optional: "ns_opt", Op: Var("noops_sameline")},
64+
}},
5965
},
6066
UASTType(uast.Alias{}, Obj{
6167
// FIXME: can't call identifierWithPos because it would take the position of the
@@ -154,11 +160,6 @@ var Normalizers = []Mapping{
154160
{Name: uast.KeyType, Op: String("BoxedBoolLiteral")},
155161
{Name: "boxed_value", Op: UASTType(uast.Bool{}, Obj{
156162
uast.KeyPos: Var("pos_"),
157-
<<<<<<< HEAD
158-
"Value": Var("lv"),
159-
||||||| merged common ancestors
160-
"Value": Var("lv"),
161-
=======
162163
"Value": Var("lv"),
163164
})},
164165
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
@@ -171,7 +172,8 @@ var Normalizers = []Mapping{
171172
{Name: uast.KeyType, Op: String("Attribute")},
172173
{Name: uast.KeyPos, Op: Var("pos_")},
173174
{Name: "attr", Op: Var("aname")},
174-
// No problem dropping this one, it's used by an internal interpreter optimization/cache
175+
// No problem dropping this one, it's used by an internal interpreter optimization
176+
//cache
175177
// without semantic meaning
176178
{Name: "ctx", Op: Any()},
177179
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
@@ -182,7 +184,6 @@ var Normalizers = []Mapping{
182184
{Name: "boxed_value", Op: UASTType(uast.Identifier{}, Obj{
183185
uast.KeyPos: Var("pos_"),
184186
"Name": Var("aname"),
185-
>>>>>>> Checkpoint with the C# like transform
186187
})},
187188
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
188189
{Name: "noops_sameline", Optional: "ns_opt", Op: Var("noops_sameline")},
@@ -251,7 +252,7 @@ var Normalizers = []Mapping{
251252
Fields{
252253
{Name: uast.KeyToken, Op: Var("name")},
253254
{Name: "default", Op: Var("init")},
254-
// TODO: change this once we've a way to store other nodes on semantic objects
255+
// FIXME: change this once we've a way to store other nodes on semantic objects
255256
// See: https://github.com/bblfsh/sdk/issues/361
256257
// See: https://github.com/bblfsh/python-driver/issues/178
257258
{Name: "noops_previous", Optional: "np_opt", Op: Any()},
@@ -269,7 +270,7 @@ var Normalizers = []Mapping{
269270
MapSemantic("vararg", uast.Argument{}, MapObj(
270271
Fields{
271272
{Name: uast.KeyToken, Op: Var("name")},
272-
// TODO: change this once we've a way to store other nodes on semantic objects
273+
// FIXME: change this once we've a way to store other nodes on semantic objects
273274
// See: https://github.com/bblfsh/sdk/issues/361
274275
// See: https://github.com/bblfsh/python-driver/issues/178
275276
{Name: "noops_previous", Optional: "np_opt", Op: Any()},
@@ -287,7 +288,7 @@ var Normalizers = []Mapping{
287288
MapSemantic("kwarg", uast.Argument{}, MapObj(
288289
Fields{
289290
{Name: uast.KeyToken, Op: Var("name")},
290-
// TODO: change this once we've a way to store other nodes on semantic objects
291+
// FIXME: change this once we've a way to store other nodes on semantic objects
291292
// See: https://github.com/bblfsh/sdk/issues/361
292293
// See: https://github.com/bblfsh/python-driver/issues/178
293294
{Name: "noops_previous", Optional: "np_opt", Op: Any()},
@@ -297,8 +298,8 @@ var Normalizers = []Mapping{
297298
{Name: "annotation", Op: Any()},
298299
},
299300
Obj{
300-
"Name": identifierWithPos("name"),
301-
"MapVariadic": Bool(true),
301+
"Name": identifierWithPos("name"),
302+
"MapVariadic": Bool(true),
302303
},
303304
)),
304305

@@ -359,7 +360,7 @@ var Normalizers = []Mapping{
359360
)},
360361
{Name: "level", Op: Var("level")},
361362
{Name: "module", Op: Var("module")},
362-
// TODO: change this once we've a way to store other nodes on semantic objects
363+
// FIXME: change this once we've a way to store other nodes on semantic objects
363364
// See: https://github.com/bblfsh/sdk/issues/361
364365
// See: https://github.com/bblfsh/python-driver/issues/178
365366
{Name: "noops_previous", Optional: "np_opt", Op: Any()},
@@ -384,7 +385,7 @@ var Normalizers = []Mapping{
384385
{Name: "names", Op: Var("names")},
385386
{Name: "module", Op: Var("module")},
386387
{Name: "level", Op: Var("level")},
387-
// TODO: change this once we've a way to store other nodes on semantic objects
388+
// FIXME: change this once we've a way to store other nodes on semantic objects
388389
// See: https://github.com/bblfsh/sdk/issues/361
389390
// See: https://github.com/bblfsh/python-driver/issues/178
390391
{Name: "noops_previous", Optional: "np_opt", Op: Any()},

fixtures/annotations.py.sem.uast

+1-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@
134134
Nodes: [
135135
{
136136
async: false,
137-
},
138-
{
137+
comments: {},
139138
decorators: [],
140139
},
141140
{ '@type': "uast:Alias",

fixtures/bench_accumulator_factory.py.sem.uast

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
Nodes: [
2020
{
2121
async: false,
22-
},
23-
{
22+
comments: {},
2423
decorators: [],
2524
},
2625
{ '@type': "uast:Alias",
@@ -46,8 +45,7 @@
4645
Nodes: [
4746
{
4847
async: false,
49-
},
50-
{
48+
comments: {},
5149
decorators: [],
5250
},
5351
{ '@type': "uast:Alias",

fixtures/bench_binary_search.py.sem.uast

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
Nodes: [
2020
{
2121
async: false,
22-
},
23-
{
22+
comments: {},
2423
decorators: [],
2524
},
2625
{ '@type': "uast:Alias",

fixtures/bench_ethopian_multiplication.py.sem.uast

+11-22
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@
106106
Nodes: [
107107
{
108108
async: false,
109-
},
110-
{
109+
comments: {},
111110
decorators: [],
112111
},
113112
{ '@type': "uast:Alias",
@@ -380,8 +379,7 @@
380379
Nodes: [
381380
{
382381
async: false,
383-
},
384-
{
382+
comments: {},
385383
decorators: [],
386384
},
387385
{ '@type': "uast:Alias",
@@ -517,8 +515,7 @@
517515
Nodes: [
518516
{
519517
async: false,
520-
},
521-
{
518+
comments: {},
522519
decorators: [],
523520
},
524521
{ '@type': "uast:Alias",
@@ -654,8 +651,7 @@
654651
Nodes: [
655652
{
656653
async: false,
657-
},
658-
{
654+
comments: {},
659655
decorators: [],
660656
},
661657
{ '@type': "uast:Alias",
@@ -833,8 +829,7 @@
833829
Nodes: [
834830
{
835831
async: false,
836-
},
837-
{
832+
comments: {},
838833
decorators: [],
839834
},
840835
{ '@type': "uast:Alias",
@@ -1166,8 +1161,7 @@
11661161
Nodes: [
11671162
{
11681163
async: false,
1169-
},
1170-
{
1164+
comments: {},
11711165
decorators: [],
11721166
},
11731167
{ '@type': "uast:Alias",
@@ -1696,8 +1690,7 @@
16961690
Nodes: [
16971691
{
16981692
async: false,
1699-
},
1700-
{
1693+
comments: {},
17011694
decorators: [],
17021695
},
17031696
{ '@type': "uast:Alias",
@@ -2227,8 +2220,7 @@
22272220
Nodes: [
22282221
{
22292222
async: false,
2230-
},
2231-
{
2223+
comments: {},
22322224
decorators: [],
22332225
},
22342226
{ '@type': "uast:Alias",
@@ -2254,8 +2246,7 @@
22542246
Nodes: [
22552247
{
22562248
async: false,
2257-
},
2258-
{
2249+
comments: {},
22592250
decorators: [],
22602251
},
22612252
{ '@type': "uast:Alias",
@@ -2565,8 +2556,7 @@
25652556
Nodes: [
25662557
{
25672558
async: false,
2568-
},
2569-
{
2559+
comments: {},
25702560
decorators: [],
25712561
},
25722562
{ '@type': "uast:Alias",
@@ -2723,8 +2713,7 @@
27232713
Nodes: [
27242714
{
27252715
async: false,
2726-
},
2727-
{
2716+
comments: {},
27282717
decorators: [],
27292718
},
27302719
{ '@type': "uast:Alias",

fixtures/bench_fibonacci.py.sem.uast

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
Nodes: [
2020
{
2121
async: false,
22-
},
23-
{
22+
comments: {},
2423
decorators: [],
2524
},
2625
{ '@type': "uast:Alias",

fixtures/bench_gcd.py.sem.uast

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
Nodes: [
2020
{
2121
async: false,
22-
},
23-
{
22+
comments: {},
2423
decorators: [],
2524
},
2625
{ '@type': "uast:Alias",

fixtures/bench_happy_numbers.py.sem.uast

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
Nodes: [
2020
{
2121
async: false,
22-
},
23-
{
22+
comments: {},
2423
decorators: [],
2524
},
2625
{ '@type': "uast:Alias",

fixtures/bench_is_prime.py.sem.uast

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
Nodes: [
2020
{
2121
async: false,
22-
},
23-
{
22+
comments: {},
2423
decorators: [],
2524
},
2625
{ '@type': "uast:Alias",

0 commit comments

Comments
 (0)