summaryrefslogtreecommitdiff
path: root/copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'copy.c')
-rw-r--r--copy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/copy.c b/copy.c
index c7d8406..4a69967 100644
--- a/copy.c
+++ b/copy.c
@@ -223,13 +223,13 @@ static void copy_expr(Copier *c, Expression *out, Expression *in) {
if (fout->index) {
copier_ident_translate(c, &fout->index);
- fout->index->decl_kind = IDECL_EXPR;
- fout->index->expr = out;
+ fout->index->decl_kind = IDECL_FOR;
+ fout->index->for_ = fout;
}
if (fout->value) {
copier_ident_translate(c, &fout->value);
- fout->value->decl_kind = IDECL_EXPR;
- fout->value->expr = out;
+ fout->value->decl_kind = IDECL_FOR;
+ fout->value->for_ = fout;
}
if (fin->flags & FOR_ANNOTATED_TYPE)
copy_type(c, &fout->type, &fin->type);
@@ -360,7 +360,7 @@ static void copy_stmt(Copier *c, Statement *out, Statement *in) {
copy_expr(c, &out->expr, &in->expr);
break;
case STMT_DECL:
- copy_decl(c, &out->decl, &in->decl);
+ copy_decl(c, out->decl = allocr_malloc(c->allocr, sizeof *out->decl), in->decl);
break;
}
}