Last issue around expr_stmt.

This commit is contained in:
Dave Halter
2017-07-27 00:09:38 +02:00
parent 8071580a4c
commit 637e557486
2 changed files with 10 additions and 2 deletions

View File

@@ -355,6 +355,12 @@ class ErrorFinder(Normalizer):
elif node.type == 'expr_stmt':
for before_equal in node.children[:-2:2]:
self._check_assignment(before_equal)
augassign = node.children[1]
if augassign != '=' and augassign.type != 'annassign': # Is augassign.
if node.children[0].type in ('testlist_star_expr', 'atom'):
message = "illegal expression for augmented assignment"
self._add_syntax_error(message, node)
elif node.type == 'with_item':
self._check_assignment(node.children[2])
elif node.type == 'del_stmt':
@@ -497,8 +503,6 @@ class ErrorFinder(Normalizer):
or type_ in ('term', 'factor')):
error = 'operator'
print(node)
if error is not None:
message = "can't %s %s" % ("delete" if is_deletion else "assign to", error)
self._add_syntax_error(message, node)

View File

@@ -100,6 +100,10 @@ def test_indentation_errors(code, positions):
'f(x=2, y)',
'f(**x, *y)',
'f(**x, y=3, z)',
'a, b += 3',
'(a, b) += 3',
'[a, b] += 3',
'[a, 1] += 3',
# All assignment tests
'lambda a: 1 = 1',
'[x for x in y] = 1',