1.1 --- a/fixnames.py Sun Mar 04 00:41:21 2007 +0100
1.2 +++ b/fixnames.py Sun Mar 04 00:42:05 2007 +0100
1.3 @@ -152,18 +152,19 @@
1.4 # Obtain a namespace either based on locals or on a structure.
1.5
1.6 structure = structure=getattr(node, "structure", None)
1.7 - self.namespace = NameOrganiser(structure)
1.8 +
1.9 + # If passed some namespace, use that as the current namespace.
1.10 +
1.11 + if namespace is not None:
1.12 + self.namespace.merge_namespace(namespace)
1.13 + else:
1.14 + self.namespace = NameOrganiser(structure)
1.15
1.16 # Record the current subprogram and namespace.
1.17
1.18 self.current_subprograms.append(node)
1.19 self.current_namespaces.append(self.namespace)
1.20
1.21 - # If passed some namespace, merge its contents into this namespace.
1.22 -
1.23 - if namespace is not None:
1.24 - self.namespace.merge_namespace(namespace)
1.25 -
1.26 # NOTE: Avoid PEP 227 (nested scopes) whilst permitting references to a
1.27 # NOTE: subprogram within itself. Do not define the name of the function
1.28 # NOTE: within a method definition.
1.29 @@ -403,7 +404,11 @@
1.30 # The special case of internal subprogram invocation is addressed by
1.31 # propagating namespace information to the subprogram and processing it.
1.32
1.33 - subprogram = self.process_node(invoke.ref, self.namespace)
1.34 + if invoke.share_locals:
1.35 + subprogram = self.process_node(invoke.ref, self.namespace)
1.36 + else:
1.37 + subprogram = self.process_node(invoke.ref)
1.38 +
1.39 if subprogram is not None:
1.40 self.subprograms.append(subprogram)
1.41 return invoke