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

Change-Id: I8fe09a64026aa9f8833197df2454a8581e98f60b
Reviewed-on: https://go-review.googlesource.com/91715
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 files changed