From b17bb103f67ea91dc2b50753922dae17331833e3 Mon Sep 17 00:00:00 2001
From: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>
Date: Tue, 9 Jun 2020 18:26:03 +0200
Subject: [PATCH] Small fixes

---
 relational/optimizations.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/relational/optimizations.py b/relational/optimizations.py
index 63b6810..53d0977 100644
--- a/relational/optimizations.py
+++ b/relational/optimizations.py
@@ -268,24 +268,23 @@ def subsequent_renames(n: parser.Node) -> Tuple[parser.Node, int]:
         n = parser.Unary(RENAME, prop, child)
 
         # 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
         # with "a->c"
-        changes = False
         for key, value in tuple(renames.items()):
+
             if value in renames:
-                changes = True
                 if renames[value] != key:
                     # Double rename on attribute
                     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
-                    renames.pop(value)  # Removes the unused one
-                    renames.pop(key)  # Removes the unused one
+                    del renames[value] # Removes the unused one
+                    del renames[key] # Removes the unused one
 
         if len(renames) == 0:  # Nothing to rename, removing the rename op
-            return n, 1
+            return n.child, 1
         else:
             n.set_rename_prop(renames)
             return n, 1