1.1 --- a/micropython/report.py Sun Jul 01 01:04:07 2012 +0200
1.2 +++ b/micropython/report.py Sun Jul 01 01:53:28 2012 +0200
1.3 @@ -23,6 +23,7 @@
1.4 from micropython.data import *
1.5 from micropython.errors import *
1.6 from os.path import exists, extsep, join
1.7 +import compiler.ast
1.8 import sys
1.9 import os
1.10 import textwrap
1.11 @@ -987,15 +988,20 @@
1.12 for target_name, is_static in possible_types]
1.13 attributes = self._get_attributes(possible_types, node.attrname)
1.14
1.15 - self._span_start("assattr")
1.16 - self._accessor_start(target_names)
1.17 + wraps_getattr = isinstance(node.expr, compiler.ast.Getattr)
1.18 +
1.19 + if not wraps_getattr:
1.20 + self._span_start("assattr")
1.21 + self._accessor_start(target_names)
1.22 self.dispatch(node.expr)
1.23 - self._accessor_end(target_names)
1.24 + if not wraps_getattr:
1.25 + self._accessor_end(target_names)
1.26 self.stream.write(".")
1.27 self._attribute_start(node.attrname, attributes)
1.28 self._span(node.attrname, "attrname" + (not target_names and " no-targets" or ""))
1.29 self._attribute_end(attributes)
1.30 - self._span_end()
1.31 + if not wraps_getattr:
1.32 + self._span_end()
1.33
1.34 def visitAssList(self, node):
1.35 self._span_start("list")
1.36 @@ -1082,15 +1088,20 @@
1.37 for target_name, is_static in possible_types]
1.38 attributes = self._get_attributes(possible_types, node.attrname)
1.39
1.40 - self._span_start("getattr")
1.41 - self._accessor_start(target_names)
1.42 + wraps_getattr = isinstance(node.expr, compiler.ast.Getattr)
1.43 +
1.44 + if not wraps_getattr:
1.45 + self._span_start("getattr")
1.46 + self._accessor_start(target_names)
1.47 self.dispatch(node.expr)
1.48 - self._accessor_end(target_names)
1.49 + if not wraps_getattr:
1.50 + self._accessor_end(target_names)
1.51 self.stream.write(".")
1.52 self._attribute_start(node.attrname, attributes)
1.53 self._span(node.attrname, "attrname" + (not target_names and " no-targets" or ""))
1.54 self._attribute_end(attributes)
1.55 - self._span_end()
1.56 + if not wraps_getattr:
1.57 + self._span_end()
1.58
1.59 def visitGenExpr(self, node):
1.60 self._span_start("genexpr")