compiler: list indirect imports separately in export data
Previously when export data referred to a type that was not defined in
a directly imported package, we would write the package name as
additional information in the type's export data. That approach
required all type information to be read in order. This patch changes
the compiler to find all references to indirectly imported packages,
and write them out as an indirectimport line in the import data. This
will permit us to read exported type data out of order.
The type traversal used to find indirect imports is a little more
complicated than necessary in preparation for later patches in this
series.
Reviewed-on: https://go-review.googlesource.com/c/143020
From-SVN: r265296