mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-10 14:41:58 +08:00
Last issue around expr_stmt.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user