changeset 230:0d4a1589f475

range_analysis: special case for some functions
author Sigurd Meldgaard <stm@daimi.au.dk>
date Mon, 04 Jan 2010 12:34:09 +0100
parents 4a5daaf345ab
children a096603611ba
files pysmcl/range_analysis.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/range_analysis.py	Mon Jan 04 11:44:12 2010 +0100
+++ b/pysmcl/range_analysis.py	Mon Jan 04 12:34:09 2010 +0100
@@ -209,8 +209,6 @@
                 if(isinstance(target, ast.Name)):
                     env[target.id] = r
                 elif(isinstance(target, ast.Subscript)):
-                    print ast.dump(target)
-                    print target.lineno
                     env[target.value.id] = env[target.value.id].combine(r)
                 else:
                     raise RuntimeError("Unsupported target of assignment")
@@ -352,8 +350,17 @@
             return Range(1, setup.nr_of_players)
         if node.func.id == "random":
             return full_range(self.prime)
-        if node.func.id == "open":
+        if node.func.id == "output":
             return self.visit(node.args[0])
+        if node.func.id == "get":
+            return self.visit(node.args[2]).combine(self.visit(node.args[3]))
+        if node.func.id == "range":
+            if(len(node.args) > 1):
+                lower = self.visit(node.args[0])
+                return lower.combine(self.visit(node.args[1]))
+            else:
+                lower = Range(0, 0)
+                return lower.combine(self.visit(node.args[0]))
         if node.func.id == "random_bit":
             return Range(0, 1)
         return full_range(self.prime)