diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-02-14 15:19:29 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-02-14 15:19:29 +0000 |
| commit | d1f65097c48afe6d869949cc5ede76a8b14401a9 (patch) | |
| tree | 6ff3ef199e46edd8998d7492361c52d188be1df6 /src/check_expr.c | |
| parent | 74d15ab84b39a83285953b963f1637956f091f45 (diff) | |
Fix immutable rules; add some general documentation
immutable is still a little weird and not completely what you'd expect. Maybe just not having it is better.
Diffstat (limited to 'src/check_expr.c')
| -rw-r--r-- | src/check_expr.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/check_expr.c b/src/check_expr.c index 25576ae85..355f4016e 100644 --- a/src/check_expr.c +++ b/src/check_expr.c @@ -4103,7 +4103,8 @@ void check_set_mode_with_indirection(Operand *o, bool indirection) { if (o->mode != Addressing_Immutable) { if (indirection) { o->mode = Addressing_Variable; - } else if (o->mode != Addressing_Variable) { + } else if (o->mode != Addressing_Variable && + o->mode != Addressing_Constant) { o->mode = Addressing_Value; } } @@ -4139,7 +4140,9 @@ bool check_set_index_data(Operand *o, Type *type, bool indirection, i64 *max_cou case Type_Slice: o->type = t->Slice.elem; - o->mode = Addressing_Variable; + if (o->mode != Addressing_Immutable) { + o->mode = Addressing_Variable; + } return true; case Type_DynamicArray: @@ -5132,7 +5135,9 @@ ExprKind check__expr_base(Checker *c, Operand *o, AstNode *node, Type *type_hint goto error; } - o->mode = Addressing_Value; + if (o->mode != Addressing_Immutable) { + o->mode = Addressing_Value; + } i64 indices[2] = {0}; AstNode *nodes[2] = {se->low, se->high}; |