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.
This commit is contained in:
Ginger Bill
2017-02-14 15:19:29 +00:00
parent 74d15ab84b
commit d1f65097c4
14 changed files with 181 additions and 154 deletions
+8 -3
View File
@@ -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};