1.1 --- a/TO_DO.txt Fri May 11 00:20:56 2012 +0200
1.2 +++ b/TO_DO.txt Mon May 14 00:19:56 2012 +0200
1.3 @@ -126,7 +126,11 @@
1.4 -----------------------
1.5
1.6 Consider handling CallFunc in micropython.inspect in order to produce instances of specific classes.
1.7 -Then, consider adding support for guard removal/verification where known instances are involved.
1.8 +Then, consider adding support for guard removal/verification where known instances are involved. For
1.9 +example:
1.10 +
1.11 + l = []
1.12 + l.append(123) # type deductions are filtered using instantiation knowledge
1.13
1.14 Frame Optimisations
1.15 ===================
2.1 --- a/micropython/common.py Fri May 11 00:20:56 2012 +0200
2.2 +++ b/micropython/common.py Mon May 14 00:19:56 2012 +0200
2.3 @@ -88,6 +88,9 @@
2.4 if not self.has_key(obj):
2.5 self[obj] = set()
2.6
2.7 + def issubset(self, other):
2.8 + return set(self).issubset(other)
2.9 +
2.10 # Dictionary and related methods.
2.11
2.12 def __getitem__(self, key):
2.13 @@ -170,6 +173,9 @@
2.14
2.15 for old_dict in dicts:
2.16 for key, value in old_dict.items():
2.17 +
2.18 + # Add existing mappings within an object set.
2.19 +
2.20 if not new_dict.has_key(key):
2.21 if value is not None:
2.22 new_dict[key] = ObjectSet(value)
3.1 --- a/micropython/data.py Fri May 11 00:20:56 2012 +0200
3.2 +++ b/micropython/data.py Mon May 14 00:19:56 2012 +0200
3.3 @@ -441,9 +441,26 @@
3.4
3.5 if not hasattr(node, "_attrspecifictypes"):
3.6 merged = {}
3.7 - for user in node._attrdefs:
3.8 - merged.update(user._attrnames)
3.9 - node._attrmerged = combine_mapping_dicts(deepen_mapping_dict(node._attrnames), deepen_mapping_dict(merged))
3.10 +
3.11 + # Get the combined usage information from the user definitions.
3.12 +
3.13 + for user in node._attrdefs or [node]:
3.14 +
3.15 + # Filter the usage for each name using the local usage
3.16 + # information.
3.17 +
3.18 + for name, usage in user._attrcombined.items():
3.19 + localusage = node._attrnames.get(name)
3.20 +
3.21 + if usage and localusage:
3.22 + if not merged.has_key(name):
3.23 + merged[name] = ObjectSet()
3.24 +
3.25 + for attrnames, value in usage.items():
3.26 + if attrnames and localusage.issubset(attrnames):
3.27 + merged[name][attrnames] = value
3.28 +
3.29 + node._attrmerged = merged
3.30 node._attrspecifictypes = self._deduce_types(node._attrmerged, objtable)
3.31
3.32 self._finalise_contributors(node, objtable)