Make HyObject.replace more resilient

This makes it work on quoted objects
This commit is contained in:
Nicolas Dandrimont 2013-10-11 08:09:28 +02:00 committed by Berker Peksag
parent 2f845c2a1e
commit f9a1995be8

View File

@ -29,7 +29,7 @@ class HyObject(object):
if isinstance(other, HyObject):
for attr in ["start_line", "end_line",
"start_column", "end_column"]:
if not hasattr(self, attr):
if not hasattr(self, attr) and hasattr(other, attr):
setattr(self, attr, getattr(other, attr))
else:
raise TypeError("Can't replace a non Hy object with a Hy object")