1.1 --- a/simplify.py Sun Oct 22 01:43:53 2006 +0200
1.2 +++ b/simplify.py Sun Oct 22 02:57:22 2006 +0200
1.3 @@ -393,9 +393,9 @@
1.4
1.5 ...to:
1.6
1.7 - Subprogram -> Conditional (test) -> (body)
1.8 - (else) -> Conditional (test) -> (body)
1.9 - (else) -> ...
1.10 + InvokeBlock -> Subprogram -> Conditional (test) -> (body)
1.11 + (else) -> Conditional (test) -> (body)
1.12 + (else) -> ...
1.13 """
1.14
1.15 subprogram = Subprogram(name=None, acquire_locals=1, returns_value=1, params=[], star=None, dstar=None)
1.16 @@ -409,6 +409,10 @@
1.17 previous = self.dispatch(compare.expr)
1.18 results = nodes = []
1.19
1.20 + # For viewing purposes, record invocations on the AST node.
1.21 +
1.22 + compare._ops = []
1.23 +
1.24 for op in compare.ops:
1.25 op_name, node = op
1.26 expr = self.dispatch(node)
1.27 @@ -444,6 +448,7 @@
1.28 raise NotImplementedError, op_name
1.29
1.30 nodes.append(StoreTemp(expr=invocation))
1.31 + compare._ops.append(invocation)
1.32
1.33 # Return from the subprogram where the test is not satisfied.
1.34
1.35 @@ -456,7 +461,8 @@
1.36
1.37 # Put subsequent operations in the else section of this conditional.
1.38
1.39 - nodes = test.else_ = [ReleaseTemp()]
1.40 + nodes[-1].else_ = [ReleaseTemp()]
1.41 + nodes = nodes[-1].else_
1.42
1.43 # For the last operation, return the result.
1.44