diff --git a/cozy/codegen/cxx.py b/cozy/codegen/cxx.py index 275dcf58..c2c84362 100644 --- a/cozy/codegen/cxx.py +++ b/cozy/codegen/cxx.py @@ -110,8 +110,11 @@ def visit_Type(self, t, name): def visit_TRecord(self, t, name): return "{} {}".format(self.typename(t), name) - def visit_TTuple(self, t, name): - return "{} {}".format(self.typename(t), name) + def visit_TTuple(self, t, name=None): + if name: + return "{} {}".format(self.typename(t), name) + else: + return "{}".format(self.typename(t)) def visit_TEnum(self, enum, name): return "{} {}".format(self.typename(enum), name) @@ -278,7 +281,7 @@ def construct_concrete(self, t : Type, e : Exp, out : Exp): x = self.fv(t, "x") indices = range(len(t.ts)) return SSeq( - SEscape("{indent}{rv} = {rhs};\n", ["rv", "rhs"], [x, e]), + SEscape("{indent}" + self.visit(t, x.id) + " = {rhs};\n", ("rhs",), (e,)), SEscape("{indent}{lhs} = {rv};\n", ["lhs", "rv"], [out, ETuple([ETupleGet(x, i).with_type(t.ts[i]) for i in indices]).with_type(t)]), )