diff options
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); |
