From 964c809fb28f2bbb5b7c35d7951911abff242b94 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 5 Feb 2018 01:50:22 +0000 Subject: compiler: in range, evaluate array if it has receives or calls The last change was incomplete, in that it did not evaluate the array argument in some cases where it had to be evaluated. This reuses the existing code for checking whether len/cap is constant. Also clean up the use of _ as the second variable in a for/range, which was previously inconsistent depending on whether the statement used = or :=. Updates golang/go#22313 Reviewed-on: https://go-review.googlesource.com/91715 From-SVN: r257377 --- gcc/go/gofrontend/parse.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/go/gofrontend/parse.cc') diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 86d3510..9700cc3 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -5459,8 +5459,7 @@ Parse::range_clause_decl(const Typed_identifier_list* til, no->var_value()->set_type_from_range_value(); if (is_new) any_new = true; - if (!Gogo::is_sink_name(pti->name())) - p_range_clause->value = Expression::make_var_reference(no, location); + p_range_clause->value = Expression::make_var_reference(no, location); } if (!any_new) -- cgit v1.1