def visit_Name(self, node):
"""All assignments to names go through this function."""
- if node.ctx in ('store', 'param'):
+ if node.ctx == 'store':
self.identifiers.declared_locally.add(node.name)
+ elif node.ctx == 'param':
+ self.identifiers.declared_parameter.add(node.name)
elif node.ctx == 'load' and not \
self.identifiers.is_declared(node.name, self.hard_scope):
self.identifiers.undeclared.add(node.name)
if isinstance(node.arg, nodes.Const) and \
isinstance(node.arg.value, basestring) and \
((isinstance(node.node, nodes.Name) and
- node.node.name not in (self.identifiers.declared_locally |
- self.identifiers.declared_parameter)) or \
+ node.node.name not in (self.identifiers.declared_locally)) or
node.node in self.identifiers.static_subscribes):
if node in self.identifiers.static_subscribes:
self.identifiers.static_subscribes[node] += 1
if args:
self.stream.expect('comma')
arg = self.parse_assign_target(name_only=True)
+ arg.set_ctx('param')
if self.stream.skip_if('assign'):
defaults.append(self.parse_expression())
args.append(arg)
return dict(self.parent, **self.vars)
def _all(meth):
- def proxy(self):
- return getattr(self.get_all(), meth)()
+ proxy = lambda self: getattr(self.get_all(), meth)()
proxy.__doc__ = getattr(dict, meth).__doc__
proxy.__name__ = meth
return proxy