1.1 --- a/docs/annotations.txt Mon Mar 05 00:25:11 2012 +0100
1.2 +++ b/docs/annotations.txt Sun Mar 11 01:49:53 2012 +0100
1.3 @@ -17,8 +17,9 @@
1.4 applicable observations, indicating usage specific to a
1.5 region of the code
1.6 _attrtypes defines types deduced either from combined attribute usage
1.7 - details (for users) or from merged attribute usage details
1.8 - (for other nodes)
1.9 + details (for users)
1.10 +_attrspecifictypes defines specific types from merged attribute usage details
1.11 + (for non-user nodes)
1.12 _attrdefs defines definition-related users which consume usage details
1.13 from the node
1.14
2.1 --- a/micropython/__init__.py Mon Mar 05 00:25:11 2012 +0100
2.2 +++ b/micropython/__init__.py Sun Mar 11 01:49:53 2012 +0100
2.3 @@ -291,7 +291,7 @@
2.4
2.5 if isinstance(obj, Module):
2.6 full_name = obj.full_name()
2.7 - attributes = {full_name : obj}
2.8 + attributes = {"#" + full_name : obj}
2.9 attributes.update(obj.module_attributes())
2.10 t.add(full_name, attributes)
2.11
2.12 @@ -309,7 +309,7 @@
2.13
2.14 # Define a table entry for the class.
2.15
2.16 - attributes = {full_name : obj}
2.17 + attributes = {"#" + full_name : obj}
2.18 attributes.update(obj.all_attributes())
2.19
2.20 # Filter out unused classes.
2.21 @@ -735,7 +735,7 @@
2.22 if isinstance(parent, Instance):
2.23 for attrvalue in attrvalues:
2.24 for name in objtable.any_possible_objects([attrname]):
2.25 - parent = objtable.access(name, name)
2.26 + parent = objtable.access(name, "#" + name)
2.27 if not isinstance(parent, Class) or \
2.28 not parent.instance_attributes().has_key(attrname):
2.29 parent.set(attrname, attrvalue, 0)
3.1 --- a/micropython/common.py Mon Mar 05 00:25:11 2012 +0100
3.2 +++ b/micropython/common.py Sun Mar 11 01:49:53 2012 +0100
3.3 @@ -310,7 +310,7 @@
3.4 for target_name, is_static in def_user._attrtypes.get(node._username, []):
3.5 target_names.add((target_name, is_static))
3.6 else:
3.7 - for target_name, is_static in user._attrtypes.get(node._username, []):
3.8 + for target_name, is_static in user._attrspecifictypes.get(node._username, []):
3.9 target_names.add((target_name, is_static))
3.10
3.11 return target_names
4.1 --- a/micropython/data.py Mon Mar 05 00:25:11 2012 +0100
4.2 +++ b/micropython/data.py Sun Mar 11 01:49:53 2012 +0100
4.3 @@ -421,6 +421,16 @@
4.4 user._attrtypes = self._deduce_types(user._attrcombined, objtable)
4.5 self._finalise_contributor(user, objtable)
4.6
4.7 + def _finalise_contributors(self, node, objtable):
4.8 +
4.9 + """
4.10 + Visit the contributing branches of 'node', finalising them using the
4.11 + given 'objtable'.
4.12 + """
4.13 +
4.14 + for contributor in node._attrbranches:
4.15 + self._finalise_contributor(contributor, objtable)
4.16 +
4.17 def _finalise_contributor(self, node, objtable):
4.18
4.19 """
4.20 @@ -428,15 +438,14 @@
4.21 program unit.
4.22 """
4.23
4.24 - if not hasattr(node, "_attrtypes"):
4.25 + if not hasattr(node, "_attrspecifictypes"):
4.26 merged = {}
4.27 for user in node._attrdefs:
4.28 merged.update(user._attrnames)
4.29 node._attrmerged = combine_mapping_dicts(deepen_mapping_dict(node._attrnames), deepen_mapping_dict(merged))
4.30 - node._attrtypes = self._deduce_types(node._attrmerged, objtable)
4.31 -
4.32 - for contributor in node._attrbranches:
4.33 - self._finalise_contributor(contributor, objtable)
4.34 + node._attrspecifictypes = self._deduce_types(node._attrmerged, objtable)
4.35 +
4.36 + self._finalise_contributors(node, objtable)
4.37
4.38 def _deduce_types(self, usage, objtable):
4.39
5.1 --- a/micropython/rsvp.py Mon Mar 05 00:25:11 2012 +0100
5.2 +++ b/micropython/rsvp.py Sun Mar 11 01:49:53 2012 +0100
5.3 @@ -93,7 +93,7 @@
5.4 def as_raw(self, objtable, paramtable, with_builtins):
5.5 item = self.item
5.6 classcode = objtable.as_list().get_code(item.full_name())
5.7 - attrcode = objtable.get_index(item.full_name())
5.8 + attrcode = objtable.get_index("#" + item.full_name())
5.9
5.10 # Include a template of an instance for use when instantiating classes.
5.11
5.12 @@ -158,7 +158,7 @@
5.13 # Generate the footprint of the constant.
5.14
5.15 classcode = objtable.as_list().get_code(type_name)
5.16 - attrcode = objtable.get_index(type_name)
5.17 + attrcode = objtable.get_index("#" + type_name)
5.18
5.19 return [
5.20 DataObject(
6.1 --- a/micropython/trans.py Mon Mar 05 00:25:11 2012 +0100
6.2 +++ b/micropython/trans.py Sun Mar 11 01:49:53 2012 +0100
6.3 @@ -53,7 +53,7 @@
6.4 # NOTE: for class equivalence tests.
6.5
6.6 try:
6.7 - obj = self.objtable.access(target_name, target_name)
6.8 + obj = self.objtable.access(target_name, "#" + target_name)
6.9
6.10 # Where no attribute entry exists, the target could be a module.
6.11 # NOTE: Should perhaps raise an error.