@@ -27,8 +27,8 @@ import (
27
27
type checkPackageHandle struct {
28
28
handle * memoize.Handle
29
29
30
- // files are the ParseGoHandles that compose the package.
31
- files []source.ParseGoHandle
30
+ // compiledGoFiles are the ParseGoHandles that compose the package.
31
+ compiledGoFiles []source.ParseGoHandle
32
32
33
33
// mode is the mode the the files were parsed in.
34
34
mode source.ParseMode
@@ -77,7 +77,7 @@ func (s *snapshot) checkPackageHandle(ctx context.Context, id packageID, mode so
77
77
//
78
78
79
79
m := cph .m
80
- files := cph .files
80
+ files := cph .compiledGoFiles
81
81
key := cph .key
82
82
fset := s .view .session .cache .fset
83
83
@@ -106,14 +106,14 @@ func (s *snapshot) buildKey(ctx context.Context, id packageID, mode source.Parse
106
106
if m == nil {
107
107
return nil , nil , errors .Errorf ("no metadata for %s" , id )
108
108
}
109
- phs , err := s .parseGoHandles (ctx , m , mode )
109
+ phs , err := s .compiledParseGoHandles (ctx , m , mode )
110
110
if err != nil {
111
111
return nil , nil , err
112
112
}
113
113
cph := & checkPackageHandle {
114
- m : m ,
115
- files : phs ,
116
- mode : mode ,
114
+ m : m ,
115
+ compiledGoFiles : phs ,
116
+ mode : mode ,
117
117
}
118
118
119
119
// Make sure all of the depList are sorted.
@@ -139,7 +139,7 @@ func (s *snapshot) buildKey(ctx context.Context, id packageID, mode source.Parse
139
139
deps [depHandle .m .pkgPath ] = depHandle
140
140
depKeys = append (depKeys , depHandle .key )
141
141
}
142
- cph .key = checkPackageKey (cph .m .id , cph .files , m .config , depKeys )
142
+ cph .key = checkPackageKey (cph .m .id , cph .compiledGoFiles , m .config , depKeys )
143
143
return cph , deps , nil
144
144
}
145
145
@@ -177,8 +177,8 @@ func (cph *checkPackageHandle) check(ctx context.Context) (*pkg, error) {
177
177
return data .pkg , data .err
178
178
}
179
179
180
- func (cph * checkPackageHandle ) Files () []source.ParseGoHandle {
181
- return cph .files
180
+ func (cph * checkPackageHandle ) CompiledGoFiles () []source.ParseGoHandle {
181
+ return cph .compiledGoFiles
182
182
}
183
183
184
184
func (cph * checkPackageHandle ) ID () string {
@@ -206,9 +206,9 @@ func (cph *checkPackageHandle) cached() (*pkg, error) {
206
206
return data .pkg , data .err
207
207
}
208
208
209
- func (s * snapshot ) parseGoHandles (ctx context.Context , m * metadata , mode source.ParseMode ) ([]source.ParseGoHandle , error ) {
210
- phs := make ([]source.ParseGoHandle , 0 , len (m .files ))
211
- for _ , uri := range m .files {
209
+ func (s * snapshot ) compiledParseGoHandles (ctx context.Context , m * metadata , mode source.ParseMode ) ([]source.ParseGoHandle , error ) {
210
+ phs := make ([]source.ParseGoHandle , 0 , len (m .compiledGoFiles ))
211
+ for _ , uri := range m .compiledGoFiles {
212
212
f , err := s .view .GetFile (ctx , uri )
213
213
if err != nil {
214
214
return nil , err
@@ -229,12 +229,12 @@ func typeCheck(ctx context.Context, fset *token.FileSet, m *metadata, mode sourc
229
229
}
230
230
231
231
pkg := & pkg {
232
- id : m .id ,
233
- pkgPath : m .pkgPath ,
234
- mode : mode ,
235
- files : phs ,
236
- imports : make (map [packagePath ]* pkg ),
237
- typesSizes : m .typesSizes ,
232
+ id : m .id ,
233
+ pkgPath : m .pkgPath ,
234
+ mode : mode ,
235
+ compiledGoFiles : phs ,
236
+ imports : make (map [packagePath ]* pkg ),
237
+ typesSizes : m .typesSizes ,
238
238
typesInfo : & types.Info {
239
239
Types : make (map [ast.Expr ]types.TypeAndValue ),
240
240
Defs : make (map [* ast.Ident ]types.Object ),
@@ -245,11 +245,11 @@ func typeCheck(ctx context.Context, fset *token.FileSet, m *metadata, mode sourc
245
245
},
246
246
}
247
247
var (
248
- files = make ([]* ast.File , len (pkg .files ))
249
- parseErrors = make ([]error , len (pkg .files ))
248
+ files = make ([]* ast.File , len (pkg .compiledGoFiles ))
249
+ parseErrors = make ([]error , len (pkg .compiledGoFiles ))
250
250
wg sync.WaitGroup
251
251
)
252
- for i , ph := range pkg .files {
252
+ for i , ph := range pkg .compiledGoFiles {
253
253
wg .Add (1 )
254
254
go func (i int , ph source.ParseGoHandle ) {
255
255
defer wg .Done ()
0 commit comments