diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-06 04:14:50 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-06 04:14:50 -0400 |
| commit | c075deeab42d65a8d84637ee59609d72db6f8fcc (patch) | |
| tree | a66bc5cb745f9f2b96152baa8463b553fdea31d9 /typecheck.c | |
| parent | dc7ee868a6d98169c6ec7305189bc578011bb5e7 (diff) | |
Actual fix for incref issue
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 7 |
1 files changed, 4 insertions, 3 deletions
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); |
