This CL makes little observable difference to the behavior but paves the way for streaming 'referrers' and (later) 'implements' queries which scan the entire workspace, but print each result as soon as it is found. The go/loader package now exposes a hook, AfterTypeCheck, that lets clients inspect each package as soon as it is type-checked, and also modify it, for instance to release unneeded data structures. A 'referrers' query applied to an exported object must scan the entire workspace. It uses this hook so to gather uses of the query object in streaming fashion. However, for now, it still accumulates the results and prints them all at the end, though I propose to change that in a follow-up. Code details: - The referrers logic had a 2-iteration loop to load first the query package and then if necessary the enlarged program. The second iteration has now been unrolled and split into globalReferrers. - Queries for package names (whether in a package declaration or a qualified identifier) have been split off into packageReferrers. It now loads all direct importers of the query package, which catches some references that were missing before. (It used to inspect only the forward dependencies of the query package.) Also: - Referrers.Pos (the position of query identifier) was removed from the JSON output. It's a nuisance to compute now, and it's already absent from the plain output. (In a follow-up, I plan to simplify the information content of the JSON output exactly what is currently printed in the plain output.) Change-Id: Ia5677636dc7b0fe4461a5d393107665757fb9a97 Reviewed-on: https://go-review.googlesource.com/19794 Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com> |
||
|---|---|---|
| benchmark/parse | ||
| blog | ||
| cmd | ||
| container/intsets | ||
| cover | ||
| go | ||
| godoc | ||
| imports | ||
| oracle | ||
| playground | ||
| present | ||
| refactor | ||
| .gitattributes | ||
| .gitignore | ||
| AUTHORS | ||
| CONTRIBUTING.md | ||
| CONTRIBUTORS | ||
| LICENSE | ||
| PATENTS | ||
| README | ||
| codereview.cfg | ||
README
This subrepository holds the source for various packages and tools that support the Go programming language. Some of the tools, godoc and vet for example, are included in binary Go distributions. Others, including the Go oracle and the test coverage tool, can be fetched with "go get". Packages include a type-checker for Go and an implementation of the Static Single Assignment form (SSA) representation for Go programs. To submit changes to this repository, see http://golang.org/doc/contribute.html.