diff options
author | Alan Donovan <adonovan@google.com> | 2018-09-27 12:42:39 -0400 |
---|---|---|
committer | Alan Donovan <adonovan@google.com> | 2018-09-27 17:26:44 +0000 |
commit | b41e4b469b2bafe522fded91c604eed59357789c (patch) | |
tree | ee225fa121178826c3d024036ee312d72ddf23dd /go | |
parent | d457fc80545a81e74af7ab0ea8ee875e86d59c65 (diff) | |
download | golang-x-tools-b41e4b469b2bafe522fded91c604eed59357789c.tar.gz |
go/analysis: add Pass.OtherFiles field
This field lists the names of non-Go files that are part of the
package under analysis.
Change-Id: Ic967dc18b98e018c691442f7378cb29db30a1454
Reviewed-on: https://go-review.googlesource.com/138136
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'go')
-rw-r--r-- | go/analysis/analysis.go | 11 | ||||
-rw-r--r-- | go/analysis/internal/checker/checker.go | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/go/analysis/analysis.go b/go/analysis/analysis.go index 8fa329c15..21fcb372b 100644 --- a/go/analysis/analysis.go +++ b/go/analysis/analysis.go @@ -90,16 +90,19 @@ func (a *Analyzer) String() string { return a.Name } // program, and has both input and an output components. // // As in a compiler, one pass may depend on the result computed by another. +// +// The Run function should not call any of the Pass functions concurrently. type Pass struct { // -- inputs -- Analyzer *Analyzer // the identity of the current analyzer // syntax and type information - Fset *token.FileSet // file position information - Files []*ast.File // the abstract syntax tree of each file - Pkg *types.Package // type information about the package - TypesInfo *types.Info // type information about the syntax trees + Fset *token.FileSet // file position information + Files []*ast.File // the abstract syntax tree of each file + OtherFiles []string // names of non-Go files of this package + Pkg *types.Package // type information about the package + TypesInfo *types.Info // type information about the syntax trees // ResultOf provides the inputs to this analysis pass, which are // the corresponding results of its prerequisite analyzers. diff --git a/go/analysis/internal/checker/checker.go b/go/analysis/internal/checker/checker.go index d9647c0e2..bbdaf2bd8 100644 --- a/go/analysis/internal/checker/checker.go +++ b/go/analysis/internal/checker/checker.go @@ -497,6 +497,7 @@ func (act *action) execOnce() { Analyzer: act.a, Fset: act.pkg.Fset, Files: act.pkg.Syntax, + OtherFiles: act.pkg.OtherFiles, Pkg: act.pkg.Types, TypesInfo: act.pkg.TypesInfo, ResultOf: inputs, |