diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-01-19 19:02:44 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-01-19 19:02:44 +0000 |
| commit | 563b1e2b285e788338aecfa9f3d6536fb9516fd0 (patch) | |
| tree | 8ea1f852f89ee765da94dab334b9a2efbec31cdc /src/check_stmt.c | |
| parent | 4603d2525ebdfa57522ec60db4a86cbc99251ee5 (diff) | |
`immutable` field prefix
Diffstat (limited to 'src/check_stmt.c')
| -rw-r--r-- | src/check_stmt.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/check_stmt.c b/src/check_stmt.c index f9315c321..c2a09070f 100644 --- a/src/check_stmt.c +++ b/src/check_stmt.c @@ -270,13 +270,10 @@ Type *check_assignment_variable(Checker *c, Operand *op_a, AstNode *lhs) { } gbString str = expr_to_string(op_b.expr); - switch (op_b.mode) { - case Addressing_Value: - error_node(op_b.expr, "Cannot assign to `%s`", str); - break; - default: + if (e != NULL && e->kind == Entity_Variable && e->Variable.is_immutable) { + error_node(op_b.expr, "Cannot assign to an immutable: `%s`", str); + } else { error_node(op_b.expr, "Cannot assign to `%s`", str); - break; } gb_string_free(str); } break; |