compiler: process packages in deterministic order

This commit is contained in:
Evgenii Stratonikov 2020-08-05 10:56:36 +03:00
parent b771d2d024
commit 6f2759be3a
7 changed files with 72 additions and 1 deletions

View file

@ -49,7 +49,8 @@ type buildInfo struct {
// ForEachFile executes fn on each file used in current program.
func (c *codegen) ForEachFile(fn func(*ast.File, *types.Package)) {
for _, pkg := range c.buildInfo.program.AllPackages {
for i := range c.packages {
pkg := c.buildInfo.program.Package(c.packages[i])
c.typeInfo = &pkg.Info
c.currPkg = pkg.Pkg
for _, f := range pkg.Files {