Make HyObject.replace more resilient
This makes it work on quoted objects
This commit is contained in:
parent
312d4816ce
commit
80feaf57fc
@ -29,7 +29,7 @@ class HyObject(object):
|
|||||||
if isinstance(other, HyObject):
|
if isinstance(other, HyObject):
|
||||||
for attr in ["start_line", "end_line",
|
for attr in ["start_line", "end_line",
|
||||||
"start_column", "end_column"]:
|
"start_column", "end_column"]:
|
||||||
if not hasattr(self, attr):
|
if not hasattr(self, attr) and hasattr(other, attr):
|
||||||
setattr(self, attr, getattr(other, attr))
|
setattr(self, attr, getattr(other, attr))
|
||||||
else:
|
else:
|
||||||
raise TypeError("Can't replace a non Hy object with a Hy object")
|
raise TypeError("Can't replace a non Hy object with a Hy object")
|
||||||
|
Loading…
Reference in New Issue
Block a user