mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Bug where if try would work incorrectly in a macro.
This commit is contained in:
@@ -98,6 +98,7 @@
|
||||
- Memory leak in Object when not using temp allocators.
|
||||
- Tracking allocator would double the allocations in the report.
|
||||
- `printf` will now show errors in the output when there are errors.
|
||||
- Bug where `if try` would work incorrectly in a macro.
|
||||
|
||||
### Stdlib changes
|
||||
|
||||
|
||||
@@ -350,6 +350,7 @@ Expr *copy_expr(CopyStruct *c, Expr *source_expr)
|
||||
case EXPR_TRY_UNWRAP:
|
||||
if (expr->resolve_status != RESOLVE_DONE)
|
||||
{
|
||||
MACRO_COPY_EXPR(expr->try_unwrap_expr.variable);
|
||||
MACRO_COPY_EXPR(expr->try_unwrap_expr.init);
|
||||
MACRO_COPY_TYPE(expr->try_unwrap_expr.type);
|
||||
}
|
||||
@@ -982,7 +983,8 @@ Decl *copy_decl(CopyStruct *c, Decl *decl)
|
||||
switch (copy->var.kind)
|
||||
{
|
||||
case VARDECL_UNWRAPPED:
|
||||
MACRO_COPY_DECL(copy->var.alias);
|
||||
case VARDECL_REWRAPPED:
|
||||
fixup_decl(c, ©->var.alias);
|
||||
break;
|
||||
case VARDECL_BITMEMBER:
|
||||
if (copy->var.bit_is_expr)
|
||||
|
||||
@@ -712,8 +712,7 @@ static inline bool sema_analyse_try_unwrap(SemaContext *context, Expr *expr)
|
||||
Decl *decl = ident->identifier_expr.decl;
|
||||
if (decl->decl_kind != DECL_VAR)
|
||||
{
|
||||
SEMA_ERROR(ident, "Expected this to be the name of an optional variable, but it isn't. Did you mistype?");
|
||||
return false;
|
||||
RETURN_SEMA_ERROR(ident, "Expected this to be the name of an optional variable, but it isn't. Did you mistype?");
|
||||
}
|
||||
if (!IS_OPTIONAL(decl))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user