forked from M-Labs/artiq
1
0
Fork 0

ARTIQIRGenerator: fix keyword/optional argument codegen in calls.

This commit is contained in:
whitequark 2015-08-31 13:42:36 -06:00
parent 501ba912c2
commit 5e0ec3a6ea
1 changed files with 4 additions and 4 deletions

View File

@ -1483,19 +1483,19 @@ class ARTIQIRGenerator(algorithm.Visitor):
for index, arg_name in enumerate(fn_typ.args): for index, arg_name in enumerate(fn_typ.args):
if keyword.arg == arg_name: if keyword.arg == arg_name:
assert args[index] is None assert args[index] is None
args[index + offset] = arg args[index] = arg
break break
elif keyword.arg in fn_typ.optargs: elif keyword.arg in fn_typ.optargs:
for index, optarg_name in enumerate(fn_typ.optargs): for index, optarg_name in enumerate(fn_typ.optargs):
if keyword.arg == optarg_name: if keyword.arg == optarg_name:
assert args[len(fn_typ.args) + index] is None assert args[len(fn_typ.args) + index] is None
args[len(fn_typ.args) + index + offset] = \ args[len(fn_typ.args) + index] = \
self.append(ir.Alloc([arg], ir.TOption(arg.type))) self.append(ir.Alloc([arg], ir.TOption(arg.type)))
break break
for index, optarg_name in enumerate(fn_typ.optargs): for index, optarg_name in enumerate(fn_typ.optargs):
if args[len(fn_typ.args) + index + offset] is None: if args[len(fn_typ.args) + index] is None:
args[len(fn_typ.args) + index + offset] = \ args[len(fn_typ.args) + index] = \
self.append(ir.Alloc([], ir.TOption(fn_typ.optargs[optarg_name]))) self.append(ir.Alloc([], ir.TOption(fn_typ.optargs[optarg_name])))
if self_arg is not None: if self_arg is not None: