|
@@ -205,6 +205,7 @@ class ModelverseKernel(object):
|
|
|
false = ""
|
|
|
|
|
|
instruction = " " * indent + "if (" + cond + "):\n" + true + "\n" + false
|
|
|
+ #TODO fix for inline calls
|
|
|
elif inst_type["value"] == "constant":
|
|
|
node, = yield [("RD", [inst, "node"])]
|
|
|
node, = yield [("RV", [node])]
|
|
@@ -219,6 +220,7 @@ class ModelverseKernel(object):
|
|
|
instruction = " " * indent + "return %s\n" % value
|
|
|
else:
|
|
|
instruction = " " * indent + "return\n"
|
|
|
+ #TODO fix for inline calls
|
|
|
elif inst_type["value"] == "declare":
|
|
|
instruction = ""
|
|
|
elif inst_type["value"] == "resolve":
|
|
@@ -234,6 +236,7 @@ class ModelverseKernel(object):
|
|
|
var, val = yield [("CALL_ARGS", [self.print_instruction, (var, 0)]),
|
|
|
("CALL_ARGS", [self.print_instruction, (val, 0)])]
|
|
|
instruction = " " * indent + var + " = " + val + "\n"
|
|
|
+ #TODO fix for inline calls
|
|
|
elif inst_type["value"] == "call":
|
|
|
func_name, = yield [("RD", [inst, "func"])]
|
|
|
func_name, = yield [("CALL_ARGS", [self.print_instruction, (func_name, 0)])]
|
|
@@ -250,6 +253,13 @@ class ModelverseKernel(object):
|
|
|
instruction = " " * indent + intrinsics[func_name](*param_list)
|
|
|
else:
|
|
|
instruction = " " * indent + func_name + "(" + ", ".join(param_list) + ")"
|
|
|
+ """
|
|
|
+ if indent == 0:
|
|
|
+ #TODO fix for inline calls
|
|
|
+ instruction = 'result, = yield [("CALL_ARGS", (%s, (' % func_name + ",".join(param_list) + ',)))]'
|
|
|
+ else:
|
|
|
+ instruction = " " * indent + 'yield [("CALL_ARGS", (%s, (' % func_name + ",".join(param_list) + ',)))]'
|
|
|
+ """
|
|
|
if indent:
|
|
|
instruction += "\n"
|
|
|
elif inst_type["value"] == "access":
|
|
@@ -261,6 +271,7 @@ class ModelverseKernel(object):
|
|
|
cond, body = yield [("CALL_ARGS", [self.print_instruction, (cond, 0)]),
|
|
|
("CALL_ARGS", [self.print_instruction, (body, indent+1)])]
|
|
|
instruction = " " * indent + "while (%s):\n" % cond + body
|
|
|
+ #TODO fix for inline calls
|
|
|
|
|
|
next_inst, = yield [("RD", [inst, "next"])]
|
|
|
if next_inst:
|