1.1 --- a/simplify/fixinstances.py Sun Jul 29 01:51:44 2007 +0200
1.2 +++ b/simplify/fixinstances.py Sun Jul 29 01:53:25 2007 +0200
1.3 @@ -72,13 +72,11 @@
1.4 # recursion issues) and a list of current namespaces (used to recall
1.5 # namespaces upon invoking internal subprograms).
1.6
1.7 - self.subprograms = set()
1.8 self.current_subprograms = []
1.9
1.10 self.module = module
1.11 - self.process_node(module)
1.12
1.13 - # Then, process all functions and methods.
1.14 + # Process all functions and methods.
1.15
1.16 for subprogram in self.module.simplifier.subprograms:
1.17
1.18 @@ -87,7 +85,16 @@
1.19
1.20 if not getattr(subprogram, "internal", 0):
1.21 for specialised in subprogram.active():
1.22 - self.subprograms.add(self.process_node(specialised))
1.23 + self.process_node(specialised)
1.24 +
1.25 + self.process_node(module)
1.26 +
1.27 + # Fix the simplifier's subprograms list itself.
1.28 +
1.29 + #subprograms = set()
1.30 + #for subprogram in self.module.simplifier.subprograms:
1.31 + # subprograms.add(self._get_replacement(subprogram))
1.32 + #self.module.simplifier.subprograms = subprograms
1.33
1.34 def process_structures(self, module):
1.35
1.36 @@ -231,9 +238,6 @@
1.37 else:
1.38 return value
1.39
1.40 - def dispatch(self, node, *args):
1.41 - return Visitor.dispatch(self, node, *args)
1.42 -
1.43 def visitInvokeFunction(self, invoke):
1.44
1.45 "Transform the 'invoke' node, performing processing on subprograms."
1.46 @@ -247,10 +251,7 @@
1.47 # The special case of internal subprogram invocation is addressed by
1.48 # propagating namespace information to the subprogram and processing it.
1.49
1.50 - subprogram = self.process_node(invoke.ref)
1.51 -
1.52 - if subprogram is not None:
1.53 - self.subprograms.add(subprogram)
1.54 + self.process_node(invoke.ref)
1.55 return invoke
1.56
1.57 # Convenience functions.
2.1 --- a/simplify/fixnames.py Sun Jul 29 01:51:44 2007 +0200
2.2 +++ b/simplify/fixnames.py Sun Jul 29 01:53:25 2007 +0200
2.3 @@ -240,9 +240,6 @@
2.4 setattr(node, attr, self.dispatches(value))
2.5 return node
2.6
2.7 - def dispatch(self, node, *args):
2.8 - return Visitor.dispatch(self, node, *args)
2.9 -
2.10 def visitGlobal(self, global_):
2.11 for name in global_.names:
2.12 self.namespace.make_global(name)
3.1 --- a/simplify/simplified/program.py Sun Jul 29 01:51:44 2007 +0200
3.2 +++ b/simplify/simplified/program.py Sun Jul 29 01:53:25 2007 +0200
3.3 @@ -422,4 +422,15 @@
3.4 self.return_locals = set()
3.5 self.namespace = Namespace() # NOTE: Temporary.
3.6
3.7 + # NOTE: Logic similar to that below is used in simplify.fixinstances to
3.8 + # NOTE: identify equivalent attributes which are subprograms.
3.9 +
3.10 + """
3.11 + def __eq__(self, other):
3.12 + return self is other or \
3.13 + not getattr(self, "internal", 0) and not getattr(other, "internal", 0) and \
3.14 + getattr(self, "copy_of", self) is getattr(other, "copy_of", other) and \
3.15 + getattr(self, "paramtypes", None) == getattr(other, "paramtypes", None)
3.16 + """
3.17 +
3.18 # vim: tabstop=4 expandtab shiftwidth=4