# HG changeset patch # User Paul Boddie # Date 1341100408 -7200 # Node ID 43760792596c50080465b0e661e8bbbb80329ec5 # Parent d7e91c9bc22899ae9b613550fb97e3c4dbf2f681 Filtered out unresolved names when producing possible accessor types. Tidied the Getattr output, hiding accessor annotations where the accessor is itself a Getattr node. diff -r d7e91c9bc228 -r 43760792596c micropython/common.py --- a/micropython/common.py Sun Jul 01 01:04:07 2012 +0200 +++ b/micropython/common.py Sun Jul 01 01:53:28 2012 +0200 @@ -19,7 +19,7 @@ this program. If not, see . """ -from micropython.data import Attr, Instance +from micropython.data import Attr, Instance, UnresolvedName from micropython.errors import * import sys @@ -70,7 +70,7 @@ target_names = set() - if hasattr(node, "_attr") and not isinstance(node._attr, Instance): + if hasattr(node, "_attr") and not isinstance(node._attr, (Instance, UnresolvedName)): attr = node._attr if isinstance(attr, Attr): target_names.add((attr.parent.full_name(), attr.is_static_attribute())) diff -r d7e91c9bc228 -r 43760792596c micropython/report.py --- a/micropython/report.py Sun Jul 01 01:04:07 2012 +0200 +++ b/micropython/report.py Sun Jul 01 01:53:28 2012 +0200 @@ -23,6 +23,7 @@ from micropython.data import * from micropython.errors import * from os.path import exists, extsep, join +import compiler.ast import sys import os import textwrap @@ -987,15 +988,20 @@ for target_name, is_static in possible_types] attributes = self._get_attributes(possible_types, node.attrname) - self._span_start("assattr") - self._accessor_start(target_names) + wraps_getattr = isinstance(node.expr, compiler.ast.Getattr) + + if not wraps_getattr: + self._span_start("assattr") + self._accessor_start(target_names) self.dispatch(node.expr) - self._accessor_end(target_names) + if not wraps_getattr: + self._accessor_end(target_names) self.stream.write(".") self._attribute_start(node.attrname, attributes) self._span(node.attrname, "attrname" + (not target_names and " no-targets" or "")) self._attribute_end(attributes) - self._span_end() + if not wraps_getattr: + self._span_end() def visitAssList(self, node): self._span_start("list") @@ -1082,15 +1088,20 @@ for target_name, is_static in possible_types] attributes = self._get_attributes(possible_types, node.attrname) - self._span_start("getattr") - self._accessor_start(target_names) + wraps_getattr = isinstance(node.expr, compiler.ast.Getattr) + + if not wraps_getattr: + self._span_start("getattr") + self._accessor_start(target_names) self.dispatch(node.expr) - self._accessor_end(target_names) + if not wraps_getattr: + self._accessor_end(target_names) self.stream.write(".") self._attribute_start(node.attrname, attributes) self._span(node.attrname, "attrname" + (not target_names and " no-targets" or "")) self._attribute_end(attributes) - self._span_end() + if not wraps_getattr: + self._span_end() def visitGenExpr(self, node): self._span_start("genexpr")