ソースを参照

Cleanup dict_read

Yentl Van Tendeloo 7 年 前
コミット
1f63868091
2 ファイル変更6 行追加7 行削除
  1. 5 6
      kernel/modelverse_kernel/main.py
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 5 - 6
kernel/modelverse_kernel/main.py

@@ -324,7 +324,7 @@ class ModelverseKernel(object):
 
             param_list = "{" + ", ".join(["'%s': %s" % (k, v) for k, v in param_list.items()]) + "}"
             actual_computation = "$$INDENT$$%s, = yield [('CALL_ARGS', [_mvk.execute_jit, (_root, %s['id'], _taskname, %s)])]\n" % (value, func_name, param_list)
-
+                
             if indent == 0:
                 # No indent, meaning that we use it inline
                 # Therefore, we output the prev and value individually
@@ -334,6 +334,7 @@ class ModelverseKernel(object):
                 # Therefore, we only do the yield
                 prev, instruction = prev_func_name + computation, actual_computation.replace("$$INDENT$$", "  " * indent)
 
+
         elif inst_type["value"] == "access":
             value, = yield [("RD", [inst, "var"])]
             (prev, instruction), = yield [("CALL_ARGS", [self.print_instruction, (value, 0, nested_indent)])]
@@ -453,11 +454,9 @@ class ModelverseKernel(object):
 
         # Run the compiled function.
         if compiled_func == primitive_functions.dict_read:
-            a = params['a']
-            b = params['b']
-            if "value" not in b:
-                b['value'], = yield [("RV", [b['id']])]
-            result, = yield [("RD", [a['id'], b['value']])]
+            if "value" not in params['b']:
+                params['b']['value'], = yield [("RV", [params['b']['id']])]
+            result, = yield [("RD", [params['a']['id'], params['b']['value']])]
             result = {'id': result}
         else:
             results = yield [("CALL_KWARGS", [compiled_func, params])]

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu May 24 10:47:51 2018
+Date:   Thu May 24 11:42:22 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server