1.1 --- a/micropython/ast.py Mon Sep 29 00:00:04 2008 +0200
1.2 +++ b/micropython/ast.py Mon Sep 29 01:30:39 2008 +0200
1.3 @@ -1016,6 +1016,7 @@
1.4 # Add arguments.
1.5 # NOTE: No support for defaults.
1.6
1.7 + self._startCallFunc()
1.8 self.new_op(temp) # Explicit context as first argument.
1.9 self.new_op(StoreFrame(0))
1.10 self._endCallFuncArgs(1)
1.11 @@ -1096,6 +1097,8 @@
1.12 operands 'temp1' and 'temp2', employing 'left_method' and 'right_method'
1.13 as defined for binary operators, but also used in comparisons (for which
1.14 this method is provided).
1.15 +
1.16 + A temporary storage reference is returned from this method.
1.17 """
1.18
1.19 right_label = self.new_label()
1.20 @@ -1133,6 +1136,8 @@
1.21 operands 'temp1' and 'temp2', employing the given 'method_name', and
1.22 jumping appropriately to 'next_method_label' where a NotImplemented
1.23 result is returned, or to 'end_label' if the method call was successful.
1.24 +
1.25 + A temporary storage reference is returned from this method.
1.26 """
1.27
1.28 end_attempt_label = self.new_label()
1.29 @@ -1384,6 +1389,8 @@
1.30 op_name, next_node = op
1.31 methods = self.comparison_methods[op_name]
1.32
1.33 + # Propagate the arguments as we traverse the construct.
1.34 +
1.35 temp1 = temp2
1.36 self.dispatch(next_node)
1.37 temp2 = self.optimiser.optimise_temp_storage()
1.38 @@ -1413,7 +1420,6 @@
1.39 self.discard_value()
1.40
1.41 elif op_name.endswith("in"):
1.42 - self._startCallFunc()
1.43 self.new_op(temp2)
1.44
1.45 # Get method on temp2.
1.46 @@ -1424,6 +1430,7 @@
1.47 # Add arguments.
1.48 # NOTE: No support for defaults.
1.49
1.50 + self._startCallFunc()
1.51 self.new_op(temp2)
1.52 self.new_op(StoreFrame(0))
1.53 self.new_op(temp1)
1.54 @@ -1449,8 +1456,15 @@
1.55 self.discard_temp(temp1)
1.56
1.57 self.discard_temp(temp2)
1.58 +
1.59 + # With the status set above, produce a boolean result.
1.60 +
1.61 self.set_label(end_label)
1.62
1.63 + # Prevent incorrect optimisation.
1.64 +
1.65 + self.optimiser.reset()
1.66 +
1.67 # Yield the appropriate value.
1.68
1.69 self._generateLoadBoolean(node)