BuildPackage builds an SSA program with IR for a single package.

It populates pkg by type-checking the specified file ASTs. All dependencies are loaded using the importer specified by tc, which typically loads compiler export data; SSA code cannot be built for those packages. BuildPackage then constructs an ssa.Program with all dependency packages created, and builds and returns the SSA package corresponding to pkg.

The caller must have set pkg.Path() to the import path.

The operation fails if there were any type-checking or import errors.

See ../ssa/example_test.go for an example.