cgo: improve error locations for cgo-constructed AST

This is mostly useful for debugging missing type conversions in CGo.
With this change, errors will have the correct source location in C
files.
This commit is contained in:
Ayke van Laethem
2019-04-20 16:55:55 +02:00
committed by Ron Evans
parent 2f2d62cc0c
commit 8e7ea92d44
3 changed files with 79 additions and 31 deletions
+6 -4
View File
@@ -30,10 +30,11 @@ type Program struct {
type Package struct {
*Program
*build.Package
Imports map[string]*Package
Importing bool
Files []*ast.File
Pkg *types.Package
Imports map[string]*Package
Importing bool
Files []*ast.File
tokenFiles map[string]*token.File
Pkg *types.Package
types.Info
}
@@ -106,6 +107,7 @@ func (p *Program) newPackage(pkg *build.Package) *Package {
Scopes: make(map[ast.Node]*types.Scope),
Selections: make(map[*ast.SelectorExpr]*types.Selection),
},
tokenFiles: map[string]*token.File{},
}
}