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

Commit 08a58f2

Browse files
authored
Merge pull request #113 from juanjux/fix/nil_none
Fix True, False and None literals
2 parents 7a8c4c0 + fa8d081 commit 08a58f2

File tree

12 files changed

+23
-26
lines changed

12 files changed

+23
-26
lines changed

driver/normalizer/tonode.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ var ToNode = &uast.ObjectToNode{
3737
"Div": "/",
3838
"Ellipsis": "...",
3939
"Eq": "==",
40-
"False": "false",
4140
"For": "for",
4241
"FloorDiv": "//",
4342
"Global": "global",
@@ -53,7 +52,6 @@ var ToNode = &uast.ObjectToNode{
5352
"LtE": "<=",
5453
"Mod": "%%",
5554
"Mult": "*",
56-
"None": "None",
5755
"Nonlocal": "nonlocal",
5856
"Not": "!",
5957
"NotEq": "!=",
@@ -65,7 +63,6 @@ var ToNode = &uast.ObjectToNode{
6563
"Return": "return",
6664
"RShift": ">>",
6765
"Sub": "-",
68-
"True": "true",
6966
"UAdd": "+",
7067
"USub": "-",
7168
"While": "while",

fixtures/assert_constant.py.native

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lineno": 1,
1414
"msg": null,
1515
"test": {
16-
"LiteralValue": true,
16+
"LiteralValue": "True",
1717
"ast_type": "BoolLiteral",
1818
"col_offset": 8,
1919
"end_col_offset": 11,
@@ -30,7 +30,7 @@
3030
"lineno": 2,
3131
"msg": null,
3232
"test": {
33-
"LiteralValue": true,
33+
"LiteralValue": "True",
3434
"ast_type": "BoolLiteral",
3535
"col_offset": 8,
3636
"end_col_offset": 11,
@@ -54,7 +54,7 @@
5454
"s": "assert message"
5555
},
5656
"test": {
57-
"LiteralValue": true,
57+
"LiteralValue": "True",
5858
"ast_type": "BoolLiteral",
5959
"col_offset": 8,
6060
"end_col_offset": 11,

fixtures/assert_constant.py.uast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Module {
2424
. . . Children: {
2525
. . . . 0: BoolLiteral {
2626
. . . . . Roles: Literal,Boolean,Expression,Primitive
27-
. . . . . TOKEN "true"
27+
. . . . . TOKEN "True"
2828
. . . . . StartPosition: {
2929
. . . . . . Offset: 7
3030
. . . . . . Line: 1
@@ -62,7 +62,7 @@ Module {
6262
. . . Children: {
6363
. . . . 0: BoolLiteral {
6464
. . . . . Roles: Literal,Boolean,Expression,Primitive
65-
. . . . . TOKEN "true"
65+
. . . . . TOKEN "True"
6666
. . . . . StartPosition: {
6767
. . . . . . Offset: 20
6868
. . . . . . Line: 2
@@ -116,7 +116,7 @@ Module {
116116
. . . . }
117117
. . . . 1: BoolLiteral {
118118
. . . . . Roles: Literal,Boolean,Expression,Primitive
119-
. . . . . TOKEN "true"
119+
. . . . . TOKEN "True"
120120
. . . . . StartPosition: {
121121
. . . . . . Offset: 32
122122
. . . . . . Line: 3

fixtures/functiondef_defaultparams.py.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"s": "polompos"
7474
},
7575
{
76-
"LiteralValue": null,
76+
"LiteralValue": "None",
7777
"ast_type": "NoneLiteral",
7878
"col_offset": 56,
7979
"end_col_offset": 59,

fixtures/functiondef_defaultparams.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Module {
156156
. . . . . . . . }
157157
. . . . . . . . 2: NoneLiteral {
158158
. . . . . . . . . Roles: Literal,Null,Expression,Primitive
159-
. . . . . . . . . TOKEN "<nil>"
159+
. . . . . . . . . TOKEN "None"
160160
. . . . . . . . . StartPosition: {
161161
. . . . . . . . . . Offset: 55
162162
. . . . . . . . . . Line: 1

fixtures/if.py.native

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"value": {
1616
"args": [
1717
{
18-
"LiteralValue": true,
18+
"LiteralValue": "True",
1919
"ast_type": "BoolLiteral",
2020
"col_offset": 11,
2121
"end_col_offset": 14,
@@ -46,7 +46,7 @@
4646
"lineno": 1,
4747
"orelse": [],
4848
"test": {
49-
"LiteralValue": true,
49+
"LiteralValue": "True",
5050
"ast_type": "BoolLiteral",
5151
"col_offset": 4,
5252
"end_col_offset": 7,
@@ -65,7 +65,7 @@
6565
"value": {
6666
"args": [
6767
{
68-
"LiteralValue": true,
68+
"LiteralValue": "True",
6969
"ast_type": "BoolLiteral",
7070
"col_offset": 11,
7171
"end_col_offset": 14,

fixtures/if.py.uast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Module {
4848
. . . . . . . . . Children: {
4949
. . . . . . . . . . 0: BoolLiteral {
5050
. . . . . . . . . . . Roles: Literal,Boolean,Expression,Primitive,Function,Call,Positional,Argument,Name
51-
. . . . . . . . . . . TOKEN "true"
51+
. . . . . . . . . . . TOKEN "True"
5252
. . . . . . . . . . . StartPosition: {
5353
. . . . . . . . . . . . Offset: 19
5454
. . . . . . . . . . . . Line: 2
@@ -90,7 +90,7 @@ Module {
9090
. . . . }
9191
. . . . 1: BoolLiteral {
9292
. . . . . Roles: Literal,Boolean,Expression,Primitive,If,Condition
93-
. . . . . TOKEN "true"
93+
. . . . . TOKEN "True"
9494
. . . . . StartPosition: {
9595
. . . . . . Offset: 3
9696
. . . . . . Line: 1
@@ -152,7 +152,7 @@ Module {
152152
. . . . . . . . . Children: {
153153
. . . . . . . . . . 0: BoolLiteral {
154154
. . . . . . . . . . . Roles: Literal,Boolean,Expression,Primitive,Function,Call,Positional,Argument,Name
155-
. . . . . . . . . . . TOKEN "true"
155+
. . . . . . . . . . . TOKEN "True"
156156
. . . . . . . . . . . StartPosition: {
157157
. . . . . . . . . . . . Offset: 55
158158
. . . . . . . . . . . . Line: 5

fixtures/issue58.py.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"n": 0
5252
},
5353
{
54-
"LiteralValue": null,
54+
"LiteralValue": "None",
5555
"ast_type": "NoneLiteral",
5656
"col_offset": 11,
5757
"end_col_offset": 14,

fixtures/issue58.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Module {
9696
. . . . . . }
9797
. . . . . . 1: NoneLiteral {
9898
. . . . . . . Roles: Literal,Null,Expression,Primitive
99-
. . . . . . . TOKEN "<nil>"
99+
. . . . . . . TOKEN "None"
100100
. . . . . . . StartPosition: {
101101
. . . . . . . . Offset: 10
102102
. . . . . . . . Line: 1

fixtures/literals_assign.py.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
}
126126
],
127127
"value": {
128-
"LiteralValue": null,
128+
"LiteralValue": "None",
129129
"ast_type": "NoneLiteral",
130130
"col_offset": 5,
131131
"end_col_offset": 8,

0 commit comments

Comments
 (0)