Author: Ronan Lamy <[email protected]>
Branch:
Changeset: r76563:152a2c95b462
Date: 2015-03-26 01:42 +0000
http://bitbucket.org/pypy/pypy/changeset/152a2c95b462/
Log: Simplify ListItem.merge()
diff --git a/rpython/annotator/listdef.py b/rpython/annotator/listdef.py
--- a/rpython/annotator/listdef.py
+++ b/rpython/annotator/listdef.py
@@ -83,9 +83,6 @@
self.setrangestep(self._step_map[type(self.range_step),
type(other.range_step)])
self.itemof.update(other.itemof)
- read_locations = self.read_locations.copy()
- other_read_locations = other.read_locations.copy()
- self.read_locations.update(other.read_locations)
s_value = self.s_value
s_other_value = other.s_value
s_new_value = unionof(s_value, s_other_value)
@@ -95,18 +92,20 @@
self.patch() # which should patch all refs to 'other'
if s_new_value != s_value:
self.s_value = s_new_value
- # reflow from reading points
- for position_key in read_locations:
- self.bookkeeper.annotator.reflowfromposition(position_key)
+ self.notify_update()
if s_new_value != s_other_value:
- # reflow from reading points
- for position_key in other_read_locations:
- other.bookkeeper.annotator.reflowfromposition(position_key)
+ other.notify_update()
+ self.read_locations.update(other.read_locations)
def patch(self):
for listdef in self.itemof:
listdef.listitem = self
+ def notify_update(self):
+ '''Reflow from all reading points'''
+ for position_key in self.read_locations:
+ self.bookkeeper.annotator.reflowfromposition(position_key)
+
def generalize(self, s_other_value):
s_new_value = unionof(self.s_value, s_other_value)
updated = s_new_value != self.s_value
@@ -114,9 +113,7 @@
if self.dont_change_any_more:
raise TooLateForChange
self.s_value = s_new_value
- # reflow from all reading points
- for position_key in self.read_locations:
- self.bookkeeper.annotator.reflowfromposition(position_key)
+ self.notify_update()
return updated
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit