Array_index_expression may be used for indexing/slicing array or
slice. If a slice element is address taken, the slice itself is
not necessarily address taken. Only propagate address-taken for
arrays.
Reviewed-on: https://go-review.googlesource.com/83877
From-SVN: r255977
-83fc0e440b8c151edc5b1c67006257aad522ca04
+9b9bece388d1bacdc9d1d0024e722ffe449d221d
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
return this->array_->is_addressable();
}
+void
+Array_index_expression::do_address_taken(bool escapes)
+{
+ // In &x[0], if x is a slice, then x's address is not taken.
+ if (!this->array_->type()->is_slice_type())
+ this->array_->address_taken(escapes);
+}
+
// Get the backend representation for an array index.
Bexpression*
do_is_addressable() const;
void
- do_address_taken(bool escapes)
- { this->array_->address_taken(escapes); }
+ do_address_taken(bool escapes);
void
do_issue_nil_check()