From c075deeab42d65a8d84637ee59609d72db6f8fcc Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 6 Sep 2024 04:14:50 -0400 Subject: Actual fix for incref issue --- typecheck.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'typecheck.c') diff --git a/typecheck.c b/typecheck.c index a832df6e..c9227844 100644 --- a/typecheck.c +++ b/typecheck.c @@ -1333,13 +1333,14 @@ bool can_be_mutated(env_t *env, ast_t *ast) case FieldAccess: { auto access = Match(ast, FieldAccess); type_t *fielded_type = get_type(env, access->fielded); - if (fielded_type->tag == TableType && streq(access->field, "values")) - return false; if (fielded_type->tag == PointerType) { auto ptr = Match(fielded_type, PointerType); return !ptr->is_readonly; + } else if (fielded_type->tag == StructType) { + return can_be_mutated(env, access->fielded); + } else { + return false; } - return can_be_mutated(env, access->fielded); } case Index: { auto index = Match(ast, Index); -- cgit v1.2.3