# HG changeset patch # User Paul Boddie # Date 1353022155 -3600 # Node ID 8718a18bb7018464cf27f5fb393b02201f8e5c4c # Parent 48af9f84cdd3f278fc12b837a3fec214807161d7 Added separate lists for genuinely unknown targets and ones that are discovered by considering an attribute name in isolation. diff -r 48af9f84cdd3 -r 8718a18bb701 micropython/__init__.py --- a/micropython/__init__.py Thu Nov 15 22:27:44 2012 +0100 +++ b/micropython/__init__.py Fri Nov 16 00:29:15 2012 +0100 @@ -89,6 +89,7 @@ # A record of nodes for which no attribute target could be found. self.unknown_target_nodes = [] + self.independent_target_nodes = [] def get_importer(self): return self.importer diff -r 48af9f84cdd3 -r 8718a18bb701 micropython/report.py --- a/micropython/report.py Thu Nov 15 22:27:44 2012 +0100 +++ b/micropython/report.py Fri Nov 16 00:29:15 2012 +0100 @@ -1059,6 +1059,7 @@ if not possible_types: possible_types = self._get_possible_types(node.attrname) + self.record_unknown_targets(possible_types, deduced, node) attributes = self._get_attributes(possible_types, node.attrname) wraps_getattr = self._has_descendant(node.expr, compiler.ast.Getattr) @@ -1165,6 +1166,7 @@ if not possible_types: possible_types = self._get_possible_types(node.attrname) + self.record_unknown_targets(possible_types, deduced, node) attributes = self._get_attributes(possible_types, node.attrname) wraps_getattr = self._has_descendant(node.expr, compiler.ast.Getattr) @@ -1457,10 +1459,13 @@ # Statistics gathering methods. def possible_accessor_types(self, node, defining_users=1): - possible_types = set([tn for (tn, st) in ASTVisitor.possible_accessor_types(self, node, defining_users)]) + return set([tn for (tn, st) in ASTVisitor.possible_accessor_types(self, node, defining_users)]) + + def record_unknown_targets(self, possible_types, deduced, node): if not possible_types: self.program.unknown_target_nodes.append((self.units[-1], node)) - return possible_types + elif not deduced: + self.program.independent_target_nodes.append((self.units[-1], node)) # Utility methods.