Small fixes
This commit is contained in:
parent
b3b5afec63
commit
b17bb103f6
@ -268,24 +268,23 @@ def subsequent_renames(n: parser.Node) -> Tuple[parser.Node, int]:
|
|||||||
n = parser.Unary(RENAME, prop, child)
|
n = parser.Unary(RENAME, prop, child)
|
||||||
|
|
||||||
# Creating a dictionary with the attributes
|
# Creating a dictionary with the attributes
|
||||||
renames = n.rename_dict()
|
renames = n.get_rename_prop()
|
||||||
|
|
||||||
# Scans dictionary to locate things like "a->b,b->c" and replace them
|
# Scans dictionary to locate things like "a->b,b->c" and replace them
|
||||||
# with "a->c"
|
# with "a->c"
|
||||||
changes = False
|
|
||||||
for key, value in tuple(renames.items()):
|
for key, value in tuple(renames.items()):
|
||||||
|
|
||||||
if value in renames:
|
if value in renames:
|
||||||
changes = True
|
|
||||||
if renames[value] != key:
|
if renames[value] != key:
|
||||||
# Double rename on attribute
|
# Double rename on attribute
|
||||||
renames[key] = renames[renames[key]] # Sets value
|
renames[key] = renames[renames[key]] # Sets value
|
||||||
renames.pop(value) # Removes the unused one
|
del renames[value] # Removes the unused one
|
||||||
else: # Cycle rename a->b,b->a
|
else: # Cycle rename a->b,b->a
|
||||||
renames.pop(value) # Removes the unused one
|
del renames[value] # Removes the unused one
|
||||||
renames.pop(key) # Removes the unused one
|
del renames[key] # Removes the unused one
|
||||||
|
|
||||||
if len(renames) == 0: # Nothing to rename, removing the rename op
|
if len(renames) == 0: # Nothing to rename, removing the rename op
|
||||||
return n, 1
|
return n.child, 1
|
||||||
else:
|
else:
|
||||||
n.set_rename_prop(renames)
|
n.set_rename_prop(renames)
|
||||||
return n, 1
|
return n, 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user