3.6-3.8 "async for" handling...

And add an if_stmt rule for 3.8. My want to extend it back to
other versions.
This commit is contained in:
rocky
2019-04-13 18:31:40 -04:00
parent 44edf1d7db
commit 5d91e96358
9 changed files with 114 additions and 6 deletions

View File

@@ -11,9 +11,10 @@ before reduction and don't reduce when there is a problem.
def checker(ast, in_loop, errors):
if ast is None:
return
in_loop = in_loop or ast.kind in ('while1stmt', 'whileTruestmt',
in_loop = (in_loop or (ast.kind in ('while1stmt', 'whileTruestmt',
'whilestmt', 'whileelsestmt', 'while1elsestmt',
'for_block')
'for_block'))
or ast.kind.startswith('async_for'))
if ast.kind in ('aug_assign1', 'aug_assign2') and ast[0][0] == 'and':
text = str(ast)
error_text = '\n# improper augmented assigment (e.g. +=, *=, ...):\n#\t' + '\n# '.join(text.split("\n")) + '\n'