1.1 --- a/docs/annotations.txt Fri Oct 25 01:02:10 2013 +0200
1.2 +++ b/docs/annotations.txt Fri Oct 25 19:03:30 2013 +0200
1.3 @@ -56,6 +56,8 @@
1.4
1.5 _attrtypes defines types deduced either from combined attribute usage
1.6 details (for users)
1.7 +_values defines a name-to-value mapping for objects that may be
1.8 + used to access attributes
1.9
1.10 Attribute Contributors
1.11 ----------------------
2.1 --- a/micropython/data.py Fri Oct 25 01:02:10 2013 +0200
2.2 +++ b/micropython/data.py Fri Oct 25 19:03:30 2013 +0200
2.3 @@ -257,8 +257,19 @@
2.4
2.5 if not self.namespace.has_key(name):
2.6 self.namespace[name] = Attr(None, self, name)
2.7 + attr = self.namespace[name]
2.8
2.9 - attr = self.namespace[name]
2.10 + # Also direct assignments to individual name users.
2.11 +
2.12 + users = self.attribute_users[-1]
2.13 +
2.14 + if users.has_key(name):
2.15 + for user in users[name]:
2.16 + user._values = user._values or {}
2.17 + user._values[name] = attr_or_value
2.18 +
2.19 + # Update the attribute records.
2.20 +
2.21 self._set_using_attr(attr, attr_or_value, single_assignment)
2.22
2.23 def _set_using_attr(self, attr, attr_or_value, single_assignment=1):
3.1 --- a/micropython/deduce.py Fri Oct 25 01:02:10 2013 +0200
3.2 +++ b/micropython/deduce.py Fri Oct 25 19:03:30 2013 +0200
3.3 @@ -327,15 +327,12 @@
3.4 else:
3.5 return
3.6
3.7 - attr = node._attr
3.8 -
3.9 - if attr:
3.10 - value = attr.get_value()
3.11 + value = node._values and node._values.get(node.name) or None
3.12
3.13 - # Need to replace any uncertain value with a concrete value.
3.14 + # Need to replace any uncertain value with a concrete value.
3.15
3.16 - if value and isinstance(value, Instance) and not isinstance(value, TypedInstance):
3.17 - attr.context_values = set([get_context_and_value(expr)])
3.18 + if value and isinstance(value, Instance) and not isinstance(value, TypedInstance):
3.19 + node._values[node.name] = expr
3.20
3.21 def visitCallFunc(self, node):
3.22
4.1 --- a/micropython/inspect.py Fri Oct 25 01:02:10 2013 +0200
4.2 +++ b/micropython/inspect.py Fri Oct 25 19:03:30 2013 +0200
4.3 @@ -914,8 +914,8 @@
4.4 self._visitAssName(node)
4.5
4.6 def _visitAssName(self, node):
4.7 - node._attr = self.store(node.name, self.expr)
4.8 self.define_attribute_user(node)
4.9 + self.store(node.name, self.expr)
4.10
4.11 # Ensure the presence of the given name in this namespace.
4.12 # NOTE: Consider not registering assignments involving methods, since