# HG changeset patch # User Paul Boddie # Date 1382835351 -7200 # Node ID 7aec95a715a8c85867fe77ae581d6bcbbc2cb618 # Parent 108075b4c4c41daf4beaea85fbdfd86d313e9e90 Removed "reverse" branches, since generation of local assignment information should now be deferred until after attribute usage has been determined and complete name/user definition information has become available. diff -r 108075b4c4c4 -r 7aec95a715a8 docs/annotations.txt --- a/docs/annotations.txt Sun Oct 27 02:39:45 2013 +0200 +++ b/docs/annotations.txt Sun Oct 27 02:55:51 2013 +0200 @@ -67,8 +67,6 @@ branch _attrbranches indicates the immediate contributors to attribute usage known to a node -_attrrevbranches indicates the immediate recipients of attribute usage known - to a node (and is thus the inverse of _attrbranches) _attrcontributors defines nodes contributing to combined attribute usage known to a node (and is thus the accumulation of all contributors via branches) diff -r 108075b4c4c4 -r 7aec95a715a8 micropython/branch.py --- a/micropython/branch.py Sun Oct 27 02:39:45 2013 +0200 +++ b/micropython/branch.py Sun Oct 27 02:55:51 2013 +0200 @@ -381,11 +381,6 @@ if node._attrbranches is None: node._attrbranches = [] - # Branches receiving usage from this node. - - if node._attrrevbranches is None: - node._attrrevbranches = [] - # Definitions receiving usage from this node. if node._attrdefs is None: @@ -542,7 +537,6 @@ for user in all_users: self._init_attribute_user(user) user._attrbranches.append(node) - node._attrrevbranches.append(user) def _abandon_branch(self, retain_branch=True): diff -r 108075b4c4c4 -r 7aec95a715a8 micropython/data.py --- a/micropython/data.py Sun Oct 27 02:39:45 2013 +0200 +++ b/micropython/data.py Sun Oct 27 02:55:51 2013 +0200 @@ -574,29 +574,15 @@ self.users = None def _get_defining_users(self): - - # NOTE: Re-evaluation may be necessary in places like loops where more - # NOTE: branch information may be added. - if self.users is None: users = set() - visited = set() for node in self.nodes: - self._get_defining_users_for_node(node, visited, users) + for user in node._attrdefs or [node]: + if user._values and user._values.has_key(self.name): + users.add(user) self.users = users return self.users - def _get_defining_users_for_node(self, node, visited, users): - if node in visited: - return - visited.add(node) - if not node._attrrevbranches: - if node._values and node._values.has_key(self.name): - users.add(node) - return - for n in node._attrrevbranches: - self._get_defining_users_for_node(n, visited, users) - def get_assignments(self): return len(self._get_defining_users())