1.1 --- a/simplify.py Sun Oct 29 21:25:08 2006 +0100
1.2 +++ b/simplify.py Sun Oct 29 22:47:42 2006 +0100
1.3 @@ -73,6 +73,7 @@
1.4 self.structures = [] # Structures/classes.
1.5 self.constants = {} # Constants.
1.6 self.current_subprograms = [] # Current subprograms being processed.
1.7 + self.current_structures = [] # Current structures being processed.
1.8 self.builtins = builtins # Whether the builtins are being processed.
1.9
1.10 # Convenience attributes.
1.11 @@ -1026,11 +1027,13 @@
1.12
1.13 subprogram = Subprogram(name=None, module=self.module, structure=structure, params=[], star=None, dstar=None)
1.14 self.current_subprograms.append(subprogram)
1.15 + self.current_structures.append(structure) # mostly for name construction
1.16
1.17 # The class is initialised using the code found inside.
1.18
1.19 subprogram.code = self.dispatch(class_.code) + [Return()]
1.20
1.21 + self.current_structures.pop()
1.22 self.current_subprograms.pop()
1.23 self.subprograms.append(subprogram); self.subnames[subprogram.full_name()] = subprogram
1.24
1.25 @@ -1120,7 +1123,9 @@
1.26 (dstar)
1.27 """
1.28
1.29 - subprogram = Subprogram(name=function.name, module=self.module, internal=0, returns_value=1, star=None, dstar=None)
1.30 + subprogram = Subprogram(name=function.name, module=self.module, structures=self.current_structures[:],
1.31 + internal=0, returns_value=1, star=None, dstar=None)
1.32 +
1.33 self.current_subprograms.append(subprogram)
1.34 subprogram.code = self.dispatch(function.code) + [Return()]
1.35 self.current_subprograms.pop()