-8ad67a72a4fa59efffc891e73ecf10020e3c565d
+ea7ac7784791dca517b6681a02c39c11bf136755
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
}
}
+// The subexpressions of an array index must be evaluated in order.
+// If this is indexing into an array, rather than a slice, then only
+// the index should be evaluated. Since this is called for values on
+// the left hand side of an assigment, evaluating the array, meaning
+// copying the array, will cause a different array to be modified.
+
+bool
+Array_index_expression::do_must_eval_subexpressions_in_order(
+ int* skip) const
+{
+ *skip = this->array_->type()->is_slice_type() ? 0 : 1;
+ return true;
+}
+
// Flatten array indexing by using temporary variables for slices and indexes.
Expression*
this->location());
}
+ // This shouldn't be called--we don't know yet.
bool
- do_must_eval_subexpressions_in_order(int* skip) const
- {
- *skip = 1;
- return true;
- }
+ do_must_eval_subexpressions_in_order(int*) const
+ { go_unreachable(); }
void
do_dump_expression(Ast_dump_context*) const;
}
bool
- do_must_eval_subexpressions_in_order(int* skip) const
- {
- *skip = 1;
- return true;
- }
+ do_must_eval_subexpressions_in_order(int* skip) const;
bool
do_is_addressable() const;
}
bool
- do_must_eval_subexpressions_in_order(int* skip) const
- {
- *skip = 1;
- return true;
- }
+ do_must_eval_subexpressions_in_order(int*) const
+ { return true; }
Bexpression*
do_get_backend(Translate_context*);
}
bool
- do_must_eval_subexpressions_in_order(int* skip) const
- {
- *skip = 1;
- return true;
- }
+ do_must_eval_subexpressions_in_order(int*) const
+ { return true; }
// A map index expression is an lvalue but it is not addressable.