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

Commit c60cdc5

Browse files
Denys Smirnovdennwc
authored andcommitted
remove Then role from loop bodies; fixes #193
Signed-off-by: Denys Smirnov <[email protected]>
1 parent 5d199d2 commit c60cdc5

33 files changed

+104
-104
lines changed

driver/normalizer/annotation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func loopAnnotate(typ string, mainRole role.Role, roles ...role.Role) Mapping {
7676
}, Obj{
7777
"body": Obj{
7878
uast.KeyType: String("For.body"),
79-
uast.KeyRoles: Roles(mainRole, role.Body, role.Then),
79+
uast.KeyRoles: Roles(mainRole, role.Body),
8080
"body_stmts": Var("body_stmts"),
8181
},
8282
"orelse": Obj{
@@ -423,7 +423,7 @@ var Annotations = []Mapping{
423423
"decorator_list": Var("decors"),
424424
"body": Var("body_stmts"),
425425
"bases": Var("bases"),
426-
"name": Var("name"),
426+
"name": Var("name"),
427427
}, Obj{
428428
uast.KeyToken: Var("name"),
429429
"decorator_list": Obj{

fixtures/bench_binary_search.py.sem.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
},
207207
},
208208
body: { '@type': "python:For.body",
209-
'@role': [Body, Then, While],
209+
'@role': [Body, While],
210210
'body_stmts': [
211211
{ '@type': "python:Assign",
212212
'@role': [Assignment, Binary, Expression],

fixtures/bench_binary_search.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
},
232232
},
233233
body: { '@type': "For.body",
234-
'@role': [Body, Then, While],
234+
'@role': [Body, While],
235235
'body_stmts': [
236236
{ '@type': "Assign",
237237
'@role': [Assignment, Binary, Expression],

fixtures/bench_ethopian_multiplication.py.sem.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
},
133133
},
134134
body: { '@type': "python:For.body",
135-
'@role': [Body, Then, While],
135+
'@role': [Body, While],
136136
'body_stmts': [
137137
{ '@type': "python:Expr",
138138
'@role': [Expression],
@@ -1187,7 +1187,7 @@
11871187
},
11881188
},
11891189
body: { '@type': "python:For.body",
1190-
'@role': [Body, For, Then],
1190+
'@role': [Body, For],
11911191
'body_stmts': [
11921192
{ '@type': "python:Print",
11931193
'@token': "print",

fixtures/bench_ethopian_multiplication.py.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
},
206206
},
207207
body: { '@type': "For.body",
208-
'@role': [Body, Then, While],
208+
'@role': [Body, While],
209209
'body_stmts': [
210210
{ '@type': "Expr",
211211
'@role': [Expression],
@@ -1130,7 +1130,7 @@
11301130
},
11311131
},
11321132
body: { '@type': "For.body",
1133-
'@role': [Body, For, Then],
1133+
'@role': [Body, For],
11341134
'body_stmts': [
11351135
{ '@type': "Print",
11361136
'@token': "print",

fixtures/bench_fizzbuzz.py.sem.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
},
2121
body: { '@type': "python:For.body",
22-
'@role': [Body, For, Then],
22+
'@role': [Body, For],
2323
'body_stmts': [
2424
{ '@type': "python:If",
2525
'@token': "if",

fixtures/bench_fizzbuzz.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
},
2121
body: { '@type': "For.body",
22-
'@role': [Body, For, Then],
22+
'@role': [Body, For],
2323
'body_stmts': [
2424
{ '@type': "If",
2525
'@token': "if",

fixtures/bench_gcd.py.sem.uast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@
680680
},
681681
},
682682
body: { '@type': "python:For.body",
683-
'@role': [Body, Then, While],
683+
'@role': [Body, While],
684684
'body_stmts': [
685685
{ '@type': "python:AugAssign",
686686
'@role': [Assignment, Binary, Expression, Operator],
@@ -1251,7 +1251,7 @@
12511251
},
12521252
},
12531253
body: { '@type': "python:For.body",
1254-
'@role': [Body, Then, While],
1254+
'@role': [Body, While],
12551255
'body_stmts': [
12561256
{ '@type': "python:While",
12571257
'@token': "while",
@@ -1269,7 +1269,7 @@
12691269
},
12701270
},
12711271
body: { '@type': "python:For.body",
1272-
'@role': [Body, Then, While],
1272+
'@role': [Body, While],
12731273
'body_stmts': [
12741274
{ '@type': "python:AugAssign",
12751275
'@role': [Assignment, Binary, Expression, Operator],

fixtures/bench_gcd.py.uast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@
673673
},
674674
},
675675
body: { '@type': "For.body",
676-
'@role': [Body, Then, While],
676+
'@role': [Body, While],
677677
'body_stmts': [
678678
{ '@type': "AugAssign",
679679
'@role': [Assignment, Binary, Expression, Operator],
@@ -1223,7 +1223,7 @@
12231223
},
12241224
},
12251225
body: { '@type': "For.body",
1226-
'@role': [Body, Then, While],
1226+
'@role': [Body, While],
12271227
'body_stmts': [
12281228
{ '@type': "While",
12291229
'@token': "while",
@@ -1241,7 +1241,7 @@
12411241
},
12421242
},
12431243
body: { '@type': "For.body",
1244-
'@role': [Body, Then, While],
1244+
'@role': [Body, While],
12451245
'body_stmts': [
12461246
{ '@type': "AugAssign",
12471247
'@role': [Assignment, Binary, Expression, Operator],

fixtures/bench_happy_numbers.py.sem.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
},
108108
},
109109
body: { '@type': "python:For.body",
110-
'@role': [Body, Then, While],
110+
'@role': [Body, While],
111111
'body_stmts': [
112112
{ '@type': "python:Assign",
113113
'@role': [Assignment, Binary, Expression],

0 commit comments

Comments
 (0)