#759035: Automate addition of eid cachekey in RQL analysis
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 07 Apr 2010 13:51:37 +0200
changeset 525 9f9c98a219a5
parent 524 60255eecf96c
child 526 af6c6e952431
#759035: Automate addition of eid cachekey in RQL analysis
__init__.py
analyze.py
--- a/__init__.py	Wed Apr 07 13:51:29 2010 +0200
+++ b/__init__.py	Wed Apr 07 13:51:37 2010 +0200
@@ -93,8 +93,8 @@
         """
         self._analyser_lock.acquire()
         try:
-            self._analyser.visit(rqlst, uid_func_mapping, kwargs,
-                                 debug)
+            return self._analyser.visit(rqlst, uid_func_mapping, kwargs,
+                                        debug)
         finally:
             self._analyser_lock.release()
 
--- a/analyze.py	Wed Apr 07 13:51:29 2010 +0200
+++ b/analyze.py	Wed Apr 07 13:51:37 2010 +0200
@@ -340,9 +340,10 @@
             assert cst.type
             if cst.type == 'Substitute':
                 eid = self.kwargs[cst.value]
+                self.deambiguifiers.add(cst.value)
             else:
                 eid = cst.value
-            cst.uidtype = self.uid_func(eid)
+            cst.uidtype = self.uid_func(cst.eval(self.kwargs))
             types.add(cst.uidtype)
         return types
 
@@ -373,10 +374,12 @@
             self.uid_func_mapping = uid_func_mapping
             self.uid_func = uid_func_mapping.values()[0]
         self.kwargs = kwargs
+        self.deambiguifiers = set()
         self._visit(node)
         if uid_func_mapping is not None:
             self.uid_func_mapping = None
             self.uid_func = None
+        return self.deambiguifiers
 
     def visit_union(self, node):
         for select in node.children: