changeset 243:d6200b882b17

Bad calls: improved handling of environment
author Sigurd Meldgaard <stm@daimi.au.dk>
date Wed, 06 Jan 2010 10:28:32 +0100
parents c452e05a342c
children 76d904123853
files pysmcl/bad_calls.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/bad_calls.py	Tue Jan 05 14:44:23 2010 +0100
+++ b/pysmcl/bad_calls.py	Wed Jan 06 10:28:32 2010 +0100
@@ -6,9 +6,8 @@
 
 def bad_calls(function_def):
     for node in ast.walk(function_def):
-        if isinstance(node, ast.stmt):
-            e = node.out_values["secret"]
         if(isinstance(node, ast.Call)):
+            e = ast.get_ancestor(node, ast.stmt).out_values["secret"]
             if(not isinstance(node.func, ast.Name)):
                 if(any([expr_secret(i, e) for i in node.args])):
                     util.error("Call of non-fixed function "
@@ -25,7 +24,8 @@
                                        " where a non-secret was expected", node)
             elif(any([expr_secret(i, e) for i in node.args])):
                 util.error("Call of non-secret "
-                           "function with secret argument", node)
+                           "function %s with secret argument" % node.func.id,
+                           node)
         if(isinstance(node, ast.Subscript)
            and expr_secret(node.slice,e)):
             util.error("Secret array indexing is not allowed", node)