compiler: emit all used files in DebugInfo.Documents

This commit is contained in:
Evgenii Stratonikov 2020-08-10 13:10:35 +03:00
parent 057e1c6e3c
commit 40fa7c0f6e
5 changed files with 25 additions and 10 deletions

View file

@ -77,6 +77,11 @@ type codegen struct {
// packages contains packages in the order they were loaded.
packages []string
// documents contains paths to all files used by the program.
documents []string
// docIndex maps file path to an index in documents array.
docIndex map[string]int
// Label table for recording jump destinations.
l []int
}
@ -1541,6 +1546,7 @@ func (c *codegen) newLambda(u uint16, lit *ast.FuncLit) {
func (c *codegen) compile(info *buildInfo, pkg *loader.PackageInfo) error {
c.mainPkg = pkg
c.analyzePkgOrder()
c.fillDocumentInfo()
funUsage := c.analyzeFuncUsage()
// Bring all imported functions into scope.
@ -1588,6 +1594,7 @@ func newCodegen(info *buildInfo, pkg *loader.PackageInfo) *codegen {
labels: map[labelWithType]uint16{},
typeInfo: &pkg.Info,
constMap: map[string]types.TypeAndValue{},
docIndex: map[string]int{},
sequencePoints: make(map[string][]DebugSeqPoint),
}