if (try foo) was handled incorrectly inside a defer.

This commit is contained in:
Christoffer Lerno
2024-10-20 18:30:03 +02:00
parent 78d5939d9d
commit d2085654a7
3 changed files with 45 additions and 1 deletions

View File

@@ -372,7 +372,14 @@ Expr *copy_expr(CopyStruct *c, Expr *source_expr)
}
else
{
MACRO_COPY_DECL(expr->try_unwrap_expr.decl);
if (expr->try_unwrap_expr.optional)
{
MACRO_COPY_DECL(expr->try_unwrap_expr.decl);
}
else
{
fixup_decl(c, &expr->try_unwrap_expr.decl);
}
}
}
return expr;