1.1 --- a/docs/annotations.txt Sun Oct 13 21:39:21 2013 +0200
1.2 +++ b/docs/annotations.txt Mon Oct 14 00:07:56 2013 +0200
1.3 @@ -6,10 +6,12 @@
1.4 Deduction Results
1.5 -----------------
1.6
1.7 -_access_type ("constant", "static", "positioned", "instance")
1.8 +_access_type ("constant", "static", "positioned", "instance",
1.9 + "impossible")
1.10 defines the kind of access involved for a particular node
1.11 and determines which of the following annotations will be
1.12 - employed
1.13 + employed, except for "impossible" which indicates an error
1.14 + condition
1.15 _value_deduced (_access_type is "constant")
1.16 defines a specific result associated with an attribute
1.17 access during deduction and based on inspection results
2.1 --- a/micropython/deduce.py Sun Oct 13 21:39:21 2013 +0200
2.2 +++ b/micropython/deduce.py Mon Oct 14 00:07:56 2013 +0200
2.3 @@ -126,6 +126,20 @@
2.4 node._set_context = instance_target and "set" or None
2.5 return
2.6
2.7 + # If a reliable target was originally specified, any usable attributes
2.8 + # should have been detected above, and any attributes deduced by other
2.9 + # means will not be compatible with the target. Thus, the nature of the
2.10 + # target is investigated: it must be an inspectable namespace or be an
2.11 + # attribute only providing such namespaces; otherwise, it is possible
2.12 + # that deduced attributes might be appropriate.
2.13 +
2.14 + if target and (
2.15 + isinstance(target, (Class, Module)) or
2.16 + isinstance(target, Attr) and not [v for v in target.get_values() if not isinstance(v, (Class, Module))]
2.17 + ):
2.18 + node._access_type = "impossible"
2.19 + return
2.20 +
2.21 # Attributes of self, which is by definition an instance.
2.22
2.23 if self.provides_self_access(node, unit):
2.24 @@ -218,6 +232,8 @@
2.25 if not targets:
2.26 targets = attribute_targets
2.27
2.28 + # Get the attributes from the deduced targets.
2.29 +
2.30 node._attrs_deduced_from_specific_usage = self.get_attributes(specific_targets, node.attrname)
2.31 node._attrs_deduced_from_usage = attrs = self.get_attributes(targets, node.attrname)
2.32
3.1 --- a/micropython/report.py Sun Oct 13 21:39:21 2013 +0200
3.2 +++ b/micropython/report.py Mon Oct 14 00:07:56 2013 +0200
3.3 @@ -93,7 +93,7 @@
3.4 z-index: 3;
3.5 }
3.6
3.7 - .no-targets {
3.8 + .no-attributes {
3.9 background-color: #d00;
3.10 color: white;
3.11 }
3.12 @@ -1161,7 +1161,7 @@
3.13
3.14 self.stream.write(".")
3.15 self._attribute_start(node.attrname, self._attributes_to_attribute_names(attributes))
3.16 - self._span(node.attrname, "attrname" + (not possible_types and " no-targets" or ""))
3.17 + self._span(node.attrname, "attrname" + ((not attributes or node._access_type == "impossible") and " no-attributes" or ""))
3.18 self._attribute_end(attributes)
3.19
3.20 if not wraps_getattr: