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

Commit 5698501

Browse files
Denys Smirnovdennwc
authored andcommitted
update the fixture and remove empty noops
Signed-off-by: Denys Smirnov <[email protected]>
1 parent 52267bf commit 5698501

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

driver/normalizer/normalizer.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,18 @@ var Normalizers = []Mapping{
245245
CommentNode(false, "comm", nil),
246246
)),
247247

248+
// remove empty noops
249+
Map(Obj{
250+
uast.KeyType: String("NoopSameLine"),
251+
uast.KeyPos: Any(),
252+
"s": String(""),
253+
}, Is(nil)),
254+
Map(Obj{
255+
uast.KeyType: String("SameLineNoops"),
256+
uast.KeyPos: Any(),
257+
"noop_lines": Check(All(Is(nil)), Any()),
258+
}, Is(nil)),
259+
248260
// FIXME: no positions for keywords in the native AST
249261
AnnotateType("keyword", MapObj(
250262
Fields{

fixtures/unicode.py.native

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
'end_col_offset': 4,
1313
'end_lineno': 1,
1414
lineno: 1,
15+
'noops_sameline': {
16+
'ast_type': "SameLineNoops",
17+
'col_offset': 3,
18+
'end_col_offset': 4,
19+
'end_lineno': 1,
20+
lineno: 1,
21+
'noop_lines': [
22+
{
23+
'ast_type': "NoopSameLine",
24+
s: "",
25+
},
26+
],
27+
},
1528
s: "𝓏",
1629
},
1730
},

fixtures/unicode.py.sem.uast

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
Format: "",
3131
Value: "𝓏",
3232
},
33+
'noops_sameline': ~,
3334
},
3435
},
3536
],

fixtures/unicode.py.uast

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,29 @@
2727
col: 4,
2828
},
2929
},
30+
'noops_sameline': { '@type': "SameLineNoops",
31+
'@role': [Comment],
32+
'@pos': { '@type': "uast:Positions",
33+
start: { '@type': "uast:Position",
34+
offset: 2,
35+
line: 1,
36+
col: 3,
37+
},
38+
end: { '@type': "uast:Position",
39+
offset: 3,
40+
line: 1,
41+
col: 4,
42+
},
43+
},
44+
'noop_lines': [
45+
{ '@type': "NoopSameLine",
46+
'@token': "",
47+
'@role': [Comment, Noop],
48+
'@pos': { '@type': "uast:Positions",
49+
},
50+
},
51+
],
52+
},
3053
},
3154
},
3255
],

0 commit comments

Comments
 (0)