# HG changeset patch # User paulb@jeremy # Date 1162158462 -3600 # Node ID c9d690ff694b907943f6b42b8188d25bc969ec9a # Parent b6bc953b39f93a6096121017311bfc079fb3a22c Added structure information to subprograms, permitting simple paths to methods to be shown in the viewer. Added invocation details to viewed while statements. diff -r b6bc953b39f9 -r c9d690ff694b simplify.py --- a/simplify.py Sun Oct 29 21:25:08 2006 +0100 +++ b/simplify.py Sun Oct 29 22:47:42 2006 +0100 @@ -73,6 +73,7 @@ self.structures = [] # Structures/classes. self.constants = {} # Constants. self.current_subprograms = [] # Current subprograms being processed. + self.current_structures = [] # Current structures being processed. self.builtins = builtins # Whether the builtins are being processed. # Convenience attributes. @@ -1026,11 +1027,13 @@ subprogram = Subprogram(name=None, module=self.module, structure=structure, params=[], star=None, dstar=None) self.current_subprograms.append(subprogram) + self.current_structures.append(structure) # mostly for name construction # The class is initialised using the code found inside. subprogram.code = self.dispatch(class_.code) + [Return()] + self.current_structures.pop() self.current_subprograms.pop() self.subprograms.append(subprogram); self.subnames[subprogram.full_name()] = subprogram @@ -1120,7 +1123,9 @@ (dstar) """ - subprogram = Subprogram(name=function.name, module=self.module, internal=0, returns_value=1, star=None, dstar=None) + subprogram = Subprogram(name=function.name, module=self.module, structures=self.current_structures[:], + internal=0, returns_value=1, star=None, dstar=None) + self.current_subprograms.append(subprogram) subprogram.code = self.dispatch(function.code) + [Return()] self.current_subprograms.pop() diff -r b6bc953b39f9 -r c9d690ff694b viewer.py --- a/viewer.py Sun Oct 29 21:25:08 2006 +0100 +++ b/viewer.py Sun Oct 29 22:47:42 2006 +0100 @@ -337,7 +337,7 @@ self._popup_start() self._invocations(conditional.test) self._popup_end() - self.stream.write("\n") + self.stream.write("\n") self.dispatch(compare) self.stream.write(":\n") self.stream.write("\n") @@ -440,7 +440,12 @@ def visitWhile(self, node): self.stream.write("
\n") self.stream.write("
\n") + self.stream.write("\n") self._keyword("while") + self._popup_start() + self._invocations(node.test) + self._popup_end() + self.stream.write("\n") self.dispatch(node.test) self.stream.write(":\n") self.stream.write("
\n") @@ -706,9 +711,10 @@ fn = invocation.full_name() module = invocation.module.name name = invocation.name + structures = [x.name for x in invocation.structures] self.stream.write("
") self.stream.write("" % (self._url(module), self._url(fn))) - self.stream.write("%s.%s" % (self._text(module), self._text(name))) + self.stream.write(self._text(".".join([module] + structures + [name]))) self.stream.write("") self.stream.write("
\n") self.stream.write("
\n")