compiler: emit all used files in DebugInfo.Documents
This commit is contained in:
parent
057e1c6e3c
commit
40fa7c0f6e
5 changed files with 25 additions and 10 deletions
|
@ -3,6 +3,7 @@ package compiler
|
|||
import (
|
||||
"errors"
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"go/types"
|
||||
"strings"
|
||||
|
||||
|
@ -163,6 +164,16 @@ func (c *codegen) visitPkg(pkg *types.Package, seen map[string]bool) {
|
|||
c.packages = append(c.packages, pkgPath)
|
||||
}
|
||||
|
||||
func (c *codegen) fillDocumentInfo() {
|
||||
fset := c.buildInfo.program.Fset
|
||||
fset.Iterate(func(f *token.File) bool {
|
||||
filePath := f.Position(f.Pos(0)).Filename
|
||||
c.docIndex[filePath] = len(c.documents)
|
||||
c.documents = append(c.documents, filePath)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func (c *codegen) analyzeFuncUsage() funcUsage {
|
||||
usage := funcUsage{}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue