mirror of
https://github.com/python/cpython
synced 2024-09-19 14:51:29 +00:00
Only treat an AugAssign as def if its the target is a Name.
Fixes last bug found with test_scope.py.
This commit is contained in:
parent
3f76b7e6e4
commit
5c9aad6043
|
@ -299,9 +299,11 @@ def visitAssName(self, node, scope, assign=1):
|
|||
scope.add_def(node.name)
|
||||
|
||||
def visitAugAssign(self, node, scope):
|
||||
# basically, the node is referenced and defined by the same expr
|
||||
# If the LHS is a name, then this counts as assignment.
|
||||
# Otherwise, it's just use.
|
||||
self.visit(node.node, scope)
|
||||
self.visit(node.node, scope, 1)
|
||||
if isinstance(node.node, ast.Name):
|
||||
self.visit(node.node, scope, 1) # XXX worry about this
|
||||
self.visit(node.expr, scope)
|
||||
|
||||
def visitAssign(self, node, scope):
|
||||
|
|
|
@ -299,9 +299,11 @@ def visitAssName(self, node, scope, assign=1):
|
|||
scope.add_def(node.name)
|
||||
|
||||
def visitAugAssign(self, node, scope):
|
||||
# basically, the node is referenced and defined by the same expr
|
||||
# If the LHS is a name, then this counts as assignment.
|
||||
# Otherwise, it's just use.
|
||||
self.visit(node.node, scope)
|
||||
self.visit(node.node, scope, 1)
|
||||
if isinstance(node.node, ast.Name):
|
||||
self.visit(node.node, scope, 1) # XXX worry about this
|
||||
self.visit(node.expr, scope)
|
||||
|
||||
def visitAssign(self, node, scope):
|
||||
|
|
Loading…
Reference in a new issue