1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00
go/importer
Alan Donovan f119874203 go.tools/oracle: improvements to command set and performance.
Command set:
- what: an extremely fast query that parses a single
  file and returns the AST stack, package name and the
  set of query modes that apply to the current selection.
  Intended for GUI tools that need to grey out UI elements.
- definition: shows the definition of an identifier.
- pointsto: the PTA features of 'describe' have been split
  out into their own command.
- describe: with PTA stripped out, the cost is now bounded by
  type checking.

Performance:
- The importer.Config.TypeCheckFuncBodies predicate supports
  setting the 'IgnoreFuncBodies' typechecker flag on a
  per-package basis.  This means we can load dependencies from
  source more quickly if we only need exported types.
  (We avoid gcimport data because it may be absent or stale.)
  This also means we can run type-based queries on packages
  that aren't part of the pointer analysis scope. (Yay.)
- Modes that require only type analysis of the query package
  run a "what" query first, and restrict their analysis scope
  to just that package and its dependencies (sans func
  bodies), making them much faster.
- We call newOracle not oracle.New in Query, so that the
  'needs' bitset isn't ignored (oops!).  This makes the
  non-PTA queries faster.

Also:
- removed vestigial timers junk.
- pos.go: existing position utilties split out into own file.
  Added parsePosFlag utility.
- numerous cosmetic tweaks.

+ very basic tests.

To do in follow-ups:
- sophisticated editor integration of "what".
- better tests.
- refactoring of control flow as described in comment.
- changes to "implements", "describe" commands.
- update design doc + user manual.

R=crawshaw, dominik.honnef
CC=golang-dev, gri
https://golang.org/cl/40630043
2013-12-13 10:04:55 -05:00
..
testdata go.tools/importer: add unit test of LoadInitialPackages. 2013-09-10 10:39:51 -04:00
importer_test.go go.tools/importer: add unit test of LoadInitialPackages. 2013-09-10 10:39:51 -04:00
importer.go go.tools/oracle: improvements to command set and performance. 2013-12-13 10:04:55 -05:00
pkginfo.go go.tools/oracle: improvements to command set and performance. 2013-12-13 10:04:55 -05:00
source_test.go go.tools/importer: move PathEnclosingInterval to package astutil. 2013-12-09 09:36:29 -05:00
util.go go.tools/importer: don't pass srcDir=os.Getwd to go/build.Import(). 2013-10-31 10:56:33 -04:00