summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-03-13 18:08:23 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-03-13 18:08:23 -0400
commita6f615edde21c3be638d9588c6c9a98cfe0bb5d9 (patch)
treed12845de3daaa67e81caf293eb04a3b0d231db3d
parent72101f2f5b80ae3c8889424351664fd651a84dec (diff)
fixed small bug
-rw-r--r--copy.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/copy.c b/copy.c
index 4270086..4f6402c 100644
--- a/copy.c
+++ b/copy.c
@@ -206,9 +206,8 @@ static void copy_fn_expr(Copier *c, FnExpr *fout, FnExpr *fin, U8 flags) {
fout->foreign.ctypes = copier_malloc(c, nctypes * sizeof(CType));
memcpy(fout->foreign.ctypes, fin->foreign.ctypes, nctypes * sizeof(CType));
} else {
- Block *prev;
+ Block *prev = c->block;
if (copy_body) {
- prev = c->block;
c->block = &fout->body;
idents_create(&fout->body.idents, c->allocr, &fout->body);
}
@@ -231,10 +230,10 @@ static void copy_fn_expr(Copier *c, FnExpr *fout, FnExpr *fin, U8 flags) {
if (fin->condition) {
fout->condition = copy_expr_(c, fin->condition);
}
- c->block = prev;
- if (copy_body) {
- copy_block(c, &fout->body, &fin->body, copy_body ? COPY_BLOCK_DONT_CREATE_IDENTS : 0);
- }
+ }
+ c->block = prev;
+ if (copy_body) {
+ copy_block(c, &fout->body, &fin->body, copy_body ? COPY_BLOCK_DONT_CREATE_IDENTS : 0);
}
}
}