1.1 --- a/micropython/data.py Sun Nov 22 23:53:30 2009 +0100
1.2 +++ b/micropython/data.py Mon Nov 23 01:22:06 2009 +0100
1.3 @@ -374,20 +374,33 @@
1.4 def _merge_branches(self):
1.5 active = self.attributes_used[-1]
1.6
1.7 + # Take each alternative branch, currently shelved, and find the
1.8 + # intersection of their contributions for each name.
1.9 +
1.10 shelved_defs = self.attribute_shelves.pop()
1.11 - defs = shelved_defs[0]
1.12 + defs = dict(shelved_defs[0])
1.13
1.14 for next_defs in shelved_defs[1:]:
1.15 for name, attrnames in next_defs.items():
1.16 if defs.has_key(name):
1.17 defs[name] = defs[name].intersection(attrnames)
1.18
1.19 + # Intersect the contributions with the previous state for each name.
1.20 +
1.21 for name, attrnames in defs.items():
1.22 if active.has_key(name):
1.23 active[name].intersection_update(attrnames)
1.24 else:
1.25 active[name] = attrnames
1.26
1.27 + # Where each shelved set of definitions is a superset of the eventual
1.28 + # definitions for a name, record these specialised sets of usage.
1.29 +
1.30 + for defs in shelved_defs:
1.31 + for name, attrnames in defs.items():
1.32 + if attrnames.issuperset(active[name]):
1.33 + self.all_attributes_used.append(attrnames)
1.34 +
1.35 # Program data structures. There are two separate kinds of structures: those
1.36 # with context, which are the values manipulated by programs, and those without
1.37 # context, which are typically constant things which are stored alongside the