# HG changeset patch # User Paul Boddie # Date 1394751289 -3600 # Node ID 02b0f1b427892b1544a5a835cfcfd7a2e9924592 # Parent 1180161dbc63c8fd02d82a2536ea3d2d625cbe14 Made a summary annotation (_access_attrs) for deduction results. Added a mouse-over/hover rule for impossible guard situation nodes. diff -r 1180161dbc63 -r 02b0f1b42789 docs/annotations.txt --- a/docs/annotations.txt Thu Mar 13 23:10:25 2014 +0100 +++ b/docs/annotations.txt Thu Mar 13 23:54:49 2014 +0100 @@ -6,6 +6,9 @@ Deduction Results ----------------- +_access_attrs the deduced attributes involved in an access, or None; + details of the deductions are given in the following + annotations _access_type ("constant", "static", "positioned", "instance", "impossible") defines the kind of access involved for a particular node diff -r 1180161dbc63 -r 02b0f1b42789 micropython/deduce.py --- a/micropython/deduce.py Thu Mar 13 23:10:25 2014 +0100 +++ b/micropython/deduce.py Thu Mar 13 23:54:49 2014 +0100 @@ -272,12 +272,16 @@ if not node._expr or isinstance(node._expr, Instance): node._expr = expr_type - # The target, on which the access is performed, may influence the effect - # on the context. We can only reliably assume that a literal constant is - # an instance: all other "instances" may actually be classes in certain - # cases. + self._annotateAttr(node, node._expr, node.attrname) + + # Make a summary annotation of the deductions. - self._annotateAttr(node, node._expr, node.attrname) + attributes = node._value_deduced and [self.get_attribute_and_value(node._value_deduced)] or \ + node._attr_deduced and [self.get_attribute_and_value(node._attr_deduced)] or \ + node._attrs_deduced or \ + map(self.get_attribute_and_value, node._attrs_deduced_from_specific_usage or []) + + node._access_attrs = attributes def _annotateAttr(self, node, target, attrname): @@ -288,6 +292,11 @@ unit = self.get_unit() + # The target, on which the access is performed, may influence the effect + # on the context. We can only reliably assume that a literal constant is + # an instance: all other "instances" may actually be classes in certain + # cases. + instance_target = isinstance(target, TypedInstance) typed_instance_attr = isinstance(target, BaseAttr) and isinstance(target.get_value(), TypedInstance) self_access = self.provides_self_access(target, unit) diff -r 1180161dbc63 -r 02b0f1b42789 micropython/report.py --- a/micropython/report.py Thu Mar 13 23:10:25 2014 +0100 +++ b/micropython/report.py Thu Mar 13 23:54:49 2014 +0100 @@ -95,6 +95,7 @@ .impossible-guard, .impossible-guard .name, + .impossible-guard .name:hover, .no-attributes { background-color: #d00; color: white;