diff options
| -rw-r--r-- | compile.c | 4 | ||||
| -rw-r--r-- | typecheck.c | 1 |
2 files changed, 3 insertions, 2 deletions
@@ -359,7 +359,7 @@ static CORD compile_lvalue(env_t *env, ast_t *ast) } else { code_err(ast, "I don't know how to assign to this target"); } - } else if (ast->tag == Var || ast->tag == FieldAccess) { + } else if (ast->tag == Var || ast->tag == FieldAccess || ast->tag == InlineCCode) { return compile(env, ast); } else { code_err(ast, "I don't know how to assign to this"); @@ -610,7 +610,7 @@ CORD compile_statement(env_t *env, ast_t *ast) type_t *lhs_t = get_type(env, Match(test->expr, UpdateAssign)->lhs); auto update = Match(test->expr, UpdateAssign); ast_t *update_var = WrapAST(ast, UpdateAssign, - .lhs=WrapAST(update->lhs, Index, .indexed=WrapAST(update->lhs, InlineCCode, .code="expr", .type=Type(PointerType, lhs_t))), + .lhs=WrapAST(update->lhs, InlineCCode, .code="(*expr)", .type=lhs_t), .op=update->op, .rhs=update->rhs); return CORD_asprintf( "test(({%r = &(%r); %r; *expr;}), %r, %r, %ld, %ld);", diff --git a/typecheck.c b/typecheck.c index 82c1f84a..eb186dff 100644 --- a/typecheck.c +++ b/typecheck.c @@ -1292,6 +1292,7 @@ PUREFUNC bool can_be_mutated(env_t *env, ast_t *ast) { switch (ast->tag) { case Var: return true; + case InlineCCode: return true; case FieldAccess: { auto access = Match(ast, FieldAccess); type_t *fielded_type = get_type(env, access->fielded); |
