# HG changeset patch # User paulb@localhost.localdomain # Date 1180399660 -7200 # Node ID 55ec3799ad4e7cb653445bc9fbcd5123bf8566f2 # Parent 22acb36b971f34cf70064cba7e92e9c853471146 Fixed shared nodes in operations which were duplicated multiple times under annotation, causing active nodes to be lost. diff -r 22acb36b971f -r 55ec3799ad4e simplify/ast.py --- a/simplify/ast.py Mon May 28 02:19:54 2007 +0200 +++ b/simplify/ast.py Tue May 29 02:47:40 2007 +0200 @@ -1763,10 +1763,22 @@ subprogram.code = [ StoreTemp( + expr=left, + index="left" + ), + StoreTemp( + expr=right, + index="right" + ), + StoreTemp( expr=InvokeFunction( binary, - expr=LoadAttr(expr=left, name=left_name), - args=[right], + expr=LoadAttr( + expr=LoadTemp(index="left"), + name=left_name), + args=[ + LoadTemp(index="right") + ], star=None, dstar=None) ), @@ -1780,8 +1792,12 @@ StoreTemp( expr=InvokeFunction( binary, - expr=LoadAttr(expr=right, name=right_name), - args=[left], + expr=LoadAttr( + expr=LoadTemp(index="right"), + name=right_name), + args=[ + LoadTemp(index="left") + ], star=None, dstar=None) ), @@ -1827,8 +1843,8 @@ # Make nice annotations for the viewer. - binary._left_call = subprogram.code[0].expr - binary._right_call = subprogram.code[1].body[1].expr + binary._left_call = subprogram.code[2].expr + binary._right_call = subprogram.code[3].body[1].expr return result @@ -1849,13 +1865,21 @@ self.current_subprograms.append(subprogram) subprogram.code = [ + StoreTemp( + expr=left, + index="left" + ), + StoreTemp( + expr=right, + index="right" + ), Try(binary, 1, body=[ ReturnFromBlock( expr=InvokeFunction( binary, - expr=LoadAttr(expr=left, name=left_name), - args=[right], + expr=LoadAttr(expr=LoadTemp(index="left"), name=left_name), + args=[LoadTemp(index="right")], star=None, dstar=None) ) @@ -1869,8 +1893,8 @@ ReturnFromBlock( expr=InvokeFunction( binary, - expr=LoadAttr(expr=right, name=right_name), - args=[left], + expr=LoadAttr(expr=LoadTemp(index="right"), name=right_name), + args=[LoadTemp(index="left")], star=None, dstar=None) ) @@ -1892,8 +1916,8 @@ # Make nice annotations for the viewer. - binary._left_call = subprogram.code[0].body[0].expr - binary._right_call = subprogram.code[0].handler[0].body[0].expr + binary._left_call = subprogram.code[2].body[0].expr + binary._right_call = subprogram.code[2].handler[0].body[0].expr return result