// appear in this list.
InitOrder []*Initializer
- // _FileVersions maps a file to the file's Go version.
+ // _FileVersions maps a file's start position to the file's Go version.
// If the file doesn't specify a version and Config.GoVersion is not
// given, the reported version is the zero version (Major, Minor = 0, 0).
- _FileVersions map[*token.File]_Version
+ _FileVersions map[token.Pos]_Version
}
func (info *Info) recordTypes() bool {
fset *token.FileSet
pkg *Package
*Info
- version version // accepted language version
- posVers map[*token.File]version // maps files to versions (may be nil)
- nextID uint64 // unique Id for type parameters (first valid Id is 1)
- objMap map[Object]*declInfo // maps package-level objects and (non-interface) methods to declaration info
- impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
- valids instanceLookup // valid *Named (incl. instantiated) types per the validType check
+ version version // accepted language version
+ posVers map[token.Pos]version // maps file start positions to versions (may be nil)
+ nextID uint64 // unique Id for type parameters (first valid Id is 1)
+ objMap map[Object]*declInfo // maps package-level objects and (non-interface) methods to declaration info
+ impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
+ valids instanceLookup // valid *Named (incl. instantiated) types per the validType check
// pkgPathMap maps package names to the set of distinct import paths we've
// seen for that name, anywhere in the import graph. It is used for
}
for _, file := range check.files {
- tfile := check.fset.File(file.FileStart)
- check.recordFileVersion(tfile, check.version) // record package version (possibly zero version)
+ fbase := file.FileStart
+ check.recordFileVersion(fbase, check.version) // record package version (possibly zero version)
v, _ := parseGoVersion(file.GoVersion)
if v.major > 0 {
if v.equal(check.version) {
continue
}
if check.posVers == nil {
- check.posVers = make(map[*token.File]version)
+ check.posVers = make(map[token.Pos]version)
}
- check.posVers[tfile] = v
- check.recordFileVersion(tfile, v) // overwrite package version
+ check.posVers[fbase] = v
+ check.recordFileVersion(fbase, v) // overwrite package version
}
}
}
}
}
-func (check *Checker) recordFileVersion(tfile *token.File, v version) {
+func (check *Checker) recordFileVersion(pos token.Pos, v version) {
if m := check._FileVersions; m != nil {
- m[tfile] = _Version{v.major, v.minor}
+ m[pos] = _Version{v.major, v.minor}
}
}